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 |
45 virtual bool Init(Profile* profile, | 46 virtual bool Init(Profile* profile, |
robertshield
2013/02/27 21:15:42
Consider documenting that this MUST be called befo
grt (UTC plus 2)
2013/02/28 02:48:41
Done.
| |
46 HWND parent, | 47 HWND parent, |
47 const gfx::Rect& bounds, | 48 const gfx::Rect& bounds, |
48 DWORD style, | 49 DWORD style, |
49 bool load_requests_via_automation, | 50 bool load_requests_via_automation, |
50 bool handle_top_level_requests, | 51 bool handle_top_level_requests, |
51 content::WebContents* existing_contents, | 52 content::WebContents* existing_contents, |
52 const GURL& initial_url, | 53 const GURL& initial_url, |
53 const GURL& referrer, | 54 const GURL& referrer, |
54 bool infobars_enabled, | 55 bool infobars_enabled, |
55 bool supports_full_tab_mode) = 0; | 56 bool supports_full_tab_mode) = 0; |
56 | 57 |
57 // Unhook the keystroke listener and notify about the closing WebContents. | 58 // Unhook the keystroke listener and notify about the closing WebContents. |
58 // This function gets called from three places, which is fine. | 59 // This function gets called from three places, which is fine. |
59 // 1. OnFinalMessage | 60 // 1. OnFinalMessage |
60 // 2. In the destructor. | 61 // 2. In the destructor. |
61 // 3. In AutomationProvider::CreateExternalTab | 62 // 3. In AutomationProvider::CreateExternalTab |
62 virtual void Uninitialize() = 0; | 63 virtual void Uninitialize() = 0; |
63 | 64 |
64 // Used to reinitialize the automation channel and related information | 65 // Used to reinitialize the automation channel and related information |
65 // for this container. Typically used when an ExternalTabContainer | 66 // for this container. Typically used when an ExternalTabContainer |
66 // instance is created by Chrome and attached to an automation client. | 67 // instance is created by Chrome and attached to an automation client. |
67 virtual bool Reinitialize(AutomationProvider* automation_provider, | 68 virtual bool Reinitialize(AutomationProvider* automation_provider, |
68 AutomationResourceMessageFilter* filter, | 69 AutomationResourceMessageFilter* filter, |
69 gfx::NativeWindow parent_window) = 0; | 70 HWND parent_window) = 0; |
70 | 71 |
71 // This is invoked when the external host reflects back to us a keyboard | 72 // This is invoked when the external host reflects back to us a keyboard |
72 // message it did not process. | 73 // message it did not process. |
73 virtual void ProcessUnhandledAccelerator(const MSG& msg) = 0; | 74 virtual void ProcessUnhandledAccelerator(const MSG& msg) = 0; |
74 | 75 |
75 // See WebContents::FocusThroughTabTraversal. Called from AutomationProvider. | 76 // See WebContents::FocusThroughTabTraversal. Called from AutomationProvider. |
76 virtual void FocusThroughTabTraversal(bool reverse, | 77 virtual void FocusThroughTabTraversal(bool reverse, |
77 bool restore_focus_to_view) = 0; | 78 bool restore_focus_to_view) = 0; |
78 | 79 |
79 virtual void RunUnloadHandlers(IPC::Message* reply_message) = 0; | 80 virtual void RunUnloadHandlers(IPC::Message* reply_message) = 0; |
80 | 81 |
81 virtual content::WebContents* GetWebContents() const = 0; | 82 virtual content::WebContents* GetWebContents() const = 0; |
82 | 83 virtual HWND GetExternalTabHWND() const = 0; |
83 // This is a wrapper for GetNativeView from ExternalTabContainerWin. | 84 virtual HWND GetContentHWND() const = 0; |
84 virtual gfx::NativeView GetExternalTabNativeView() const = 0; | |
85 | 85 |
86 virtual void SetTabHandle(int handle) = 0; | 86 virtual void SetTabHandle(int handle) = 0; |
87 virtual int GetTabHandle() const = 0; | 87 virtual int GetTabHandle() const = 0; |
88 | 88 |
89 // Returns true if the context menu command was handled | 89 // Returns true if the context menu command was handled |
90 virtual bool ExecuteContextMenuCommand(int command) = 0; | 90 virtual bool ExecuteContextMenuCommand(int command) = 0; |
91 | 91 |
92 protected: | 92 protected: |
93 virtual ~ExternalTabContainer() {} | 93 virtual ~ExternalTabContainer() {} |
94 | 94 |
95 private: | 95 private: |
96 friend class base::RefCounted<ExternalTabContainer>; | 96 friend class base::RefCounted<ExternalTabContainer>; |
97 }; | 97 }; |
98 | 98 |
99 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ | 99 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_H_ |
OLD | NEW |