| 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" |
| 15 #include "ui/gfx/geometry/rect.h" |
| 14 | 16 |
| 15 class Browser; | 17 class Browser; |
| 16 class Profile; | 18 class Profile; |
| 17 | 19 |
| 18 namespace content { | 20 namespace content { |
| 19 class WebContents; | 21 class WebContents; |
| 20 } | 22 } |
| 21 | 23 |
| 22 // Implementation of LiveTabContext which uses an instance of | 24 // Implementation of LiveTabContext which uses an instance of |
| 23 // Browser in order to fulfil its duties. | 25 // Browser in order to fulfil its duties. |
| 24 class BrowserLiveTabContext : public sessions::LiveTabContext { | 26 class BrowserLiveTabContext : public sessions::LiveTabContext { |
| 25 public: | 27 public: |
| 26 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} | 28 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} |
| 27 ~BrowserLiveTabContext() override {} | 29 ~BrowserLiveTabContext() override {} |
| 28 | 30 |
| 29 // Overridden from LiveTabContext: | 31 // Overridden from LiveTabContext: |
| 30 void ShowBrowserWindow() override; | 32 void ShowBrowserWindow() override; |
| 31 const SessionID& GetSessionID() const override; | 33 const SessionID& GetSessionID() const override; |
| 32 int GetTabCount() const override; | 34 int GetTabCount() const override; |
| 33 int GetSelectedIndex() const override; | 35 int GetSelectedIndex() const override; |
| 34 std::string GetAppName() const override; | 36 std::string GetAppName() const override; |
| 35 sessions::LiveTab* GetLiveTabAt(int index) const override; | 37 sessions::LiveTab* GetLiveTabAt(int index) const override; |
| 36 sessions::LiveTab* GetActiveLiveTab() const override; | 38 sessions::LiveTab* GetActiveLiveTab() const override; |
| 37 bool IsTabPinned(int index) const override; | 39 bool IsTabPinned(int index) const override; |
| 40 const gfx::Rect GetBounds() const override; |
| 41 ui::WindowShowState GetShowState() const override; |
| 42 std::string GetWorkspace() const override; |
| 43 |
| 38 sessions::LiveTab* AddRestoredTab( | 44 sessions::LiveTab* AddRestoredTab( |
| 39 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 45 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 40 int tab_index, | 46 int tab_index, |
| 41 int selected_navigation, | 47 int selected_navigation, |
| 42 const std::string& extension_app_id, | 48 const std::string& extension_app_id, |
| 43 bool select, | 49 bool select, |
| 44 bool pin, | 50 bool pin, |
| 45 bool from_last_session, | 51 bool from_last_session, |
| 46 const sessions::PlatformSpecificTabData* storage_namespace, | 52 const sessions::PlatformSpecificTabData* storage_namespace, |
| 47 const std::string& user_agent_override) override; | 53 const std::string& user_agent_override) override; |
| 48 sessions::LiveTab* ReplaceRestoredTab( | 54 sessions::LiveTab* ReplaceRestoredTab( |
| 49 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 55 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 50 int selected_navigation, | 56 int selected_navigation, |
| 51 bool from_last_session, | 57 bool from_last_session, |
| 52 const std::string& extension_app_id, | 58 const std::string& extension_app_id, |
| 53 const sessions::PlatformSpecificTabData* tab_platform_data, | 59 const sessions::PlatformSpecificTabData* tab_platform_data, |
| 54 const std::string& user_agent_override) override; | 60 const std::string& user_agent_override) override; |
| 55 void CloseTab() override; | 61 void CloseTab() override; |
| 56 | 62 |
| 57 // see Browser::Create | 63 // see Browser::Create |
| 58 static sessions::LiveTabContext* Create( | 64 static sessions::LiveTabContext* Create(Profile* profile, |
| 59 Profile* profile, | 65 const std::string& app_name, |
| 60 const std::string& app_name); | 66 const gfx::Rect& bounds, |
| 67 ui::WindowShowState show_state, |
| 68 const std::string& workspace); |
| 61 | 69 |
| 62 // see browser::FindBrowserForWebContents | 70 // see browser::FindBrowserForWebContents |
| 63 static sessions::LiveTabContext* FindContextForWebContents( | 71 static sessions::LiveTabContext* FindContextForWebContents( |
| 64 const content::WebContents* contents); | 72 const content::WebContents* contents); |
| 65 | 73 |
| 66 // see chrome::FindBrowserWithID | 74 // see chrome::FindBrowserWithID |
| 67 // Returns the LiveTabContext of the Browser with |desired_id| if | 75 // Returns the LiveTabContext of the Browser with |desired_id| if |
| 68 // such a Browser exists. | 76 // such a Browser exists. |
| 69 static sessions::LiveTabContext* FindContextWithID( | 77 static sessions::LiveTabContext* FindContextWithID( |
| 70 SessionID::id_type desired_id); | 78 SessionID::id_type desired_id); |
| 71 | 79 |
| 72 private: | 80 private: |
| 73 Browser* browser_; | 81 Browser* browser_; |
| 74 | 82 |
| 75 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext); | 83 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext); |
| 76 }; | 84 }; |
| 77 | 85 |
| 78 #endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 86 #endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ |
| OLD | NEW |