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_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ |
6 #define CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ | 6 #define CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class Message; | 27 class Message; |
28 } | 28 } |
29 | 29 |
30 class ExternalTabContainer : public base::RefCounted<ExternalTabContainer> { | 30 class ExternalTabContainer : public base::RefCounted<ExternalTabContainer> { |
31 public: | 31 public: |
32 static ExternalTabContainer* Create( | 32 static ExternalTabContainer* Create( |
33 AutomationProvider* automation_provider, | 33 AutomationProvider* automation_provider, |
34 AutomationResourceMessageFilter* filter); | 34 AutomationResourceMessageFilter* filter); |
35 | 35 |
36 // A helper method that retrieves the ExternalTabContainer object that | 36 // A helper method that retrieves the ExternalTabContainer object that |
37 // hosts the given tab window. | 37 // hosts the given WebContents. |
38 static ExternalTabContainer* GetContainerForTab(HWND tab_window); | 38 static ExternalTabContainer* GetContainerForTab( |
| 39 content::WebContents* web_contents); |
39 | 40 |
40 // Returns the ExternalTabContainer instance associated with the cookie | 41 // Returns the ExternalTabContainer instance associated with the cookie |
41 // passed in. It also erases the corresponding reference from the map. | 42 // passed in. It also erases the corresponding reference from the map. |
42 // Returns NULL if we fail to find the cookie in the map. | 43 // Returns NULL if we fail to find the cookie in the map. |
43 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); | 44 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); |
44 | 45 |
| 46 // Initializes the instance. This must be invoked before any other member |
| 47 // functions. |
45 virtual bool Init(Profile* profile, | 48 virtual bool Init(Profile* profile, |
46 HWND parent, | 49 HWND parent, |
47 const gfx::Rect& bounds, | 50 const gfx::Rect& bounds, |
48 DWORD style, | 51 DWORD style, |
49 bool load_requests_via_automation, | 52 bool load_requests_via_automation, |
50 bool handle_top_level_requests, | 53 bool handle_top_level_requests, |
51 content::WebContents* existing_contents, | 54 content::WebContents* existing_contents, |
52 const GURL& initial_url, | 55 const GURL& initial_url, |
53 const GURL& referrer, | 56 const GURL& referrer, |
54 bool infobars_enabled, | 57 bool infobars_enabled, |
55 bool supports_full_tab_mode) = 0; | 58 bool supports_full_tab_mode) = 0; |
56 | 59 |
57 // Unhook the keystroke listener and notify about the closing WebContents. | 60 // Unhook the keystroke listener and notify about the closing WebContents. |
58 // This function gets called from three places, which is fine. | 61 // This function gets called from three places, which is fine. |
59 // 1. OnFinalMessage | 62 // 1. OnFinalMessage |
60 // 2. In the destructor. | 63 // 2. In the destructor. |
61 // 3. In AutomationProvider::CreateExternalTab | 64 // 3. In AutomationProvider::CreateExternalTab |
62 virtual void Uninitialize() = 0; | 65 virtual void Uninitialize() = 0; |
63 | 66 |
64 // Used to reinitialize the automation channel and related information | 67 // Used to reinitialize the automation channel and related information |
65 // for this container. Typically used when an ExternalTabContainer | 68 // for this container. Typically used when an ExternalTabContainer |
66 // instance is created by Chrome and attached to an automation client. | 69 // instance is created by Chrome and attached to an automation client. |
67 virtual bool Reinitialize(AutomationProvider* automation_provider, | 70 virtual bool Reinitialize(AutomationProvider* automation_provider, |
68 AutomationResourceMessageFilter* filter, | 71 AutomationResourceMessageFilter* filter, |
69 gfx::NativeWindow parent_window) = 0; | 72 HWND parent_window) = 0; |
70 | 73 |
71 // This is invoked when the external host reflects back to us a keyboard | 74 // This is invoked when the external host reflects back to us a keyboard |
72 // message it did not process. | 75 // message it did not process. |
73 virtual void ProcessUnhandledAccelerator(const MSG& msg) = 0; | 76 virtual void ProcessUnhandledAccelerator(const MSG& msg) = 0; |
74 | 77 |
75 // See WebContents::FocusThroughTabTraversal. Called from AutomationProvider. | 78 // See WebContents::FocusThroughTabTraversal. Called from AutomationProvider. |
76 virtual void FocusThroughTabTraversal(bool reverse, | 79 virtual void FocusThroughTabTraversal(bool reverse, |
77 bool restore_focus_to_view) = 0; | 80 bool restore_focus_to_view) = 0; |
78 | 81 |
79 virtual void RunUnloadHandlers(IPC::Message* reply_message) = 0; | 82 virtual void RunUnloadHandlers(IPC::Message* reply_message) = 0; |
80 | 83 |
81 virtual content::WebContents* GetWebContents() const = 0; | 84 virtual content::WebContents* GetWebContents() const = 0; |
82 | 85 virtual HWND GetExternalTabHWND() const = 0; |
83 // This is a wrapper for GetNativeView from ExternalTabContainerWin. | 86 virtual HWND GetContentHWND() const = 0; |
84 virtual gfx::NativeView GetExternalTabNativeView() const = 0; | |
85 | 87 |
86 virtual void SetTabHandle(int handle) = 0; | 88 virtual void SetTabHandle(int handle) = 0; |
87 virtual int GetTabHandle() const = 0; | 89 virtual int GetTabHandle() const = 0; |
88 | 90 |
89 // Returns true if the context menu command was handled | 91 // Returns true if the context menu command was handled |
90 virtual bool ExecuteContextMenuCommand(int command) = 0; | 92 virtual bool ExecuteContextMenuCommand(int command) = 0; |
91 | 93 |
92 protected: | 94 protected: |
93 virtual ~ExternalTabContainer() {} | 95 virtual ~ExternalTabContainer() {} |
94 | 96 |
95 private: | 97 private: |
96 friend class base::RefCounted<ExternalTabContainer>; | 98 friend class base::RefCounted<ExternalTabContainer>; |
97 }; | 99 }; |
98 | 100 |
99 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ | 101 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ |
OLD | NEW |