| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/sessions/core/live_tab_context.h" | 13 #include "components/sessions/core/live_tab_context.h" |
| 14 #include "ui/base/ui_base_types.h" |
| 14 | 15 |
| 15 class Browser; | 16 class Browser; |
| 16 class Profile; | 17 class Profile; |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 class WebContents; | 20 class WebContents; |
| 20 } | 21 } |
| 21 | 22 |
| 23 namespace gfx { |
| 24 class Rect; |
| 25 } |
| 26 |
| 22 // Implementation of LiveTabContext which uses an instance of | 27 // Implementation of LiveTabContext which uses an instance of |
| 23 // Browser in order to fulfil its duties. | 28 // Browser in order to fulfil its duties. |
| 24 class BrowserLiveTabContext : public sessions::LiveTabContext { | 29 class BrowserLiveTabContext : public sessions::LiveTabContext { |
| 25 public: | 30 public: |
| 26 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} | 31 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} |
| 27 ~BrowserLiveTabContext() override {} | 32 ~BrowserLiveTabContext() override {} |
| 28 | 33 |
| 29 // Overridden from LiveTabContext: | 34 // Overridden from LiveTabContext: |
| 30 void ShowBrowserWindow() override; | 35 void ShowBrowserWindow() override; |
| 31 const SessionID& GetSessionID() const override; | 36 const SessionID& GetSessionID() const override; |
| 32 int GetTabCount() const override; | 37 int GetTabCount() const override; |
| 33 int GetSelectedIndex() const override; | 38 int GetSelectedIndex() const override; |
| 34 std::string GetAppName() const override; | 39 std::string GetAppName() const override; |
| 35 sessions::LiveTab* GetLiveTabAt(int index) const override; | 40 sessions::LiveTab* GetLiveTabAt(int index) const override; |
| 36 sessions::LiveTab* GetActiveLiveTab() const override; | 41 sessions::LiveTab* GetActiveLiveTab() const override; |
| 37 bool IsTabPinned(int index) const override; | 42 bool IsTabPinned(int index) const override; |
| 43 const gfx::Rect GetRestoredBounds() const override; |
| 44 ui::WindowShowState GetRestoredState() const override; |
| 45 std::string GetWorkspace() const override; |
| 46 |
| 38 sessions::LiveTab* AddRestoredTab( | 47 sessions::LiveTab* AddRestoredTab( |
| 39 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 48 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 40 int tab_index, | 49 int tab_index, |
| 41 int selected_navigation, | 50 int selected_navigation, |
| 42 const std::string& extension_app_id, | 51 const std::string& extension_app_id, |
| 43 bool select, | 52 bool select, |
| 44 bool pin, | 53 bool pin, |
| 45 bool from_last_session, | 54 bool from_last_session, |
| 46 const sessions::PlatformSpecificTabData* storage_namespace, | 55 const sessions::PlatformSpecificTabData* storage_namespace, |
| 47 const std::string& user_agent_override) override; | 56 const std::string& user_agent_override) override; |
| 48 sessions::LiveTab* ReplaceRestoredTab( | 57 sessions::LiveTab* ReplaceRestoredTab( |
| 49 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 58 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 50 int selected_navigation, | 59 int selected_navigation, |
| 51 bool from_last_session, | 60 bool from_last_session, |
| 52 const std::string& extension_app_id, | 61 const std::string& extension_app_id, |
| 53 const sessions::PlatformSpecificTabData* tab_platform_data, | 62 const sessions::PlatformSpecificTabData* tab_platform_data, |
| 54 const std::string& user_agent_override) override; | 63 const std::string& user_agent_override) override; |
| 55 void CloseTab() override; | 64 void CloseTab() override; |
| 56 | 65 |
| 57 // see Browser::Create | 66 // see Browser::Create |
| 58 static sessions::LiveTabContext* Create( | 67 static sessions::LiveTabContext* Create(Profile* profile, |
| 59 Profile* profile, | 68 const std::string& app_name, |
| 60 const std::string& app_name); | 69 const gfx::Rect& bounds, |
| 70 ui::WindowShowState show_state, |
| 71 const std::string& workspace); |
| 61 | 72 |
| 62 // see browser::FindBrowserForWebContents | 73 // see browser::FindBrowserForWebContents |
| 63 static sessions::LiveTabContext* FindContextForWebContents( | 74 static sessions::LiveTabContext* FindContextForWebContents( |
| 64 const content::WebContents* contents); | 75 const content::WebContents* contents); |
| 65 | 76 |
| 66 // see chrome::FindBrowserWithID | 77 // see chrome::FindBrowserWithID |
| 67 // Returns the LiveTabContext of the Browser with |desired_id| if | 78 // Returns the LiveTabContext of the Browser with |desired_id| if |
| 68 // such a Browser exists. | 79 // such a Browser exists. |
| 69 static sessions::LiveTabContext* FindContextWithID( | 80 static sessions::LiveTabContext* FindContextWithID( |
| 70 SessionID::id_type desired_id); | 81 SessionID::id_type desired_id); |
| 71 | 82 |
| 72 private: | 83 private: |
| 73 Browser* browser_; | 84 Browser* browser_; |
| 74 | 85 |
| 75 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext); | 86 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext); |
| 76 }; | 87 }; |
| 77 | 88 |
| 78 #endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 89 #endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ |
| OLD | NEW |