OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CONTAINER_WIN_H_ | 5 #ifndef CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
6 #define CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ | 6 #define CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/automation/automation_resource_message_filter.h" | 15 #include "chrome/browser/automation/automation_resource_message_filter.h" |
16 #include "chrome/browser/net/chrome_url_request_context.h" | 16 #include "chrome/browser/net/chrome_url_request_context.h" |
| 17 #include "chrome/browser/ui/download/download_tab_helper_delegate.h" |
17 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" | 18 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" |
18 #include "chrome/browser/ui/views/infobars/infobar_container.h" | 19 #include "chrome/browser/ui/views/infobars/infobar_container.h" |
19 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 20 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
20 #include "content/browser/tab_contents/tab_contents_delegate.h" | 21 #include "content/browser/tab_contents/tab_contents_delegate.h" |
21 #include "content/common/navigation_types.h" | 22 #include "content/common/navigation_types.h" |
22 #include "content/common/notification_observer.h" | 23 #include "content/common/notification_observer.h" |
23 #include "content/common/notification_registrar.h" | 24 #include "content/common/notification_registrar.h" |
24 #include "views/accelerator.h" | 25 #include "views/accelerator.h" |
25 #include "views/widget/widget_win.h" | 26 #include "views/widget/widget_win.h" |
26 | 27 |
27 class AutomationProvider; | 28 class AutomationProvider; |
28 class Browser; | 29 class Browser; |
29 class Profile; | 30 class Profile; |
30 class TabContentsContainer; | 31 class TabContentsContainer; |
31 class TabContentsWrapper; | 32 class TabContentsWrapper; |
32 class RenderViewContextMenuViews; | 33 class RenderViewContextMenuViews; |
33 struct NavigationInfo; | 34 struct NavigationInfo; |
34 | 35 |
35 namespace ui { | 36 namespace ui { |
36 class ViewProp; | 37 class ViewProp; |
37 } | 38 } |
38 | 39 |
39 // This class serves as the container window for an external tab. | 40 // This class serves as the container window for an external tab. |
40 // An external tab is a Chrome tab that is meant to displayed in an | 41 // An external tab is a Chrome tab that is meant to displayed in an |
41 // external process. This class provides the FocusManger needed by the | 42 // external process. This class provides the FocusManger needed by the |
42 // TabContents as well as an implementation of TabContentsDelegate. | 43 // TabContents as well as an implementation of TabContentsDelegate. |
43 class ExternalTabContainer : public TabContentsDelegate, | 44 class ExternalTabContainer : public TabContentsDelegate, |
| 45 public DownloadTabHelperDelegate, |
44 public NotificationObserver, | 46 public NotificationObserver, |
45 public views::WidgetWin, | 47 public views::WidgetWin, |
46 public base::RefCounted<ExternalTabContainer>, | 48 public base::RefCounted<ExternalTabContainer>, |
47 public views::AcceleratorTarget, | 49 public views::AcceleratorTarget, |
48 public InfoBarContainer::Delegate, | 50 public InfoBarContainer::Delegate, |
49 public BrowserBubbleHost { | 51 public BrowserBubbleHost { |
50 public: | 52 public: |
51 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; | 53 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; |
52 | 54 |
53 ExternalTabContainer(AutomationProvider* automation, | 55 ExternalTabContainer(AutomationProvider* automation, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 const std::string& target); | 137 const std::string& target); |
136 virtual bool IsExternalTabContainer() const; | 138 virtual bool IsExternalTabContainer() const; |
137 virtual gfx::NativeWindow GetFrameNativeWindow(); | 139 virtual gfx::NativeWindow GetFrameNativeWindow(); |
138 | 140 |
139 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 141 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
140 bool* is_keyboard_shortcut); | 142 bool* is_keyboard_shortcut); |
141 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 143 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
142 | 144 |
143 virtual bool TakeFocus(bool reverse); | 145 virtual bool TakeFocus(bool reverse); |
144 | 146 |
145 virtual bool CanDownload(int request_id); | |
146 | |
147 virtual bool OnGoToEntryOffset(int offset); | 147 virtual bool OnGoToEntryOffset(int offset); |
148 | 148 |
149 virtual void ShowPageInfo(Profile* profile, | 149 virtual void ShowPageInfo(Profile* profile, |
150 const GURL& url, | 150 const GURL& url, |
151 const NavigationEntry::SSLStatus& ssl, | 151 const NavigationEntry::SSLStatus& ssl, |
152 bool show_history); | 152 bool show_history); |
153 | 153 |
154 // Handles the context menu display operation. This allows external | 154 // Handles the context menu display operation. This allows external |
155 // hosts to customize the menu. | 155 // hosts to customize the menu. |
156 virtual bool HandleContextMenu(const ContextMenuParams& params); | 156 virtual bool HandleContextMenu(const ContextMenuParams& params); |
157 | 157 |
158 // Executes the context menu command identified by the command | 158 // Executes the context menu command identified by the command |
159 // parameter. | 159 // parameter. |
160 virtual bool ExecuteContextMenuCommand(int command); | 160 virtual bool ExecuteContextMenuCommand(int command); |
161 | 161 |
162 virtual void BeforeUnloadFired(TabContents* tab, | 162 virtual void BeforeUnloadFired(TabContents* tab, |
163 bool proceed, | 163 bool proceed, |
164 bool* proceed_to_fire_unload); | 164 bool* proceed_to_fire_unload); |
165 | 165 |
166 void ShowRepostFormWarningDialog(TabContents* tab_contents); | 166 void ShowRepostFormWarningDialog(TabContents* tab_contents); |
167 | 167 |
168 void RegisterRenderViewHost(RenderViewHost* render_view_host); | 168 void RegisterRenderViewHost(RenderViewHost* render_view_host); |
169 void UnregisterRenderViewHost(RenderViewHost* render_view_host); | 169 void UnregisterRenderViewHost(RenderViewHost* render_view_host); |
170 | 170 |
171 // Overridden from NotificationObserver: | 171 // Overridden from NotificationObserver: |
172 virtual void Observe(NotificationType type, | 172 virtual void Observe(NotificationType type, |
173 const NotificationSource& source, | 173 const NotificationSource& source, |
174 const NotificationDetails& details); | 174 const NotificationDetails& details); |
175 | 175 |
| 176 // Overridden from DownloadTabHelperDelegate: |
| 177 virtual bool CanDownload(int request_id) OVERRIDE; |
| 178 virtual void OnStartDownload(DownloadItem* download, |
| 179 TabContentsWrapper* tab) OVERRIDE; |
| 180 |
176 // Returns the ExternalTabContainer instance associated with the cookie | 181 // Returns the ExternalTabContainer instance associated with the cookie |
177 // passed in. It also erases the corresponding reference from the map. | 182 // passed in. It also erases the corresponding reference from the map. |
178 // Returns NULL if we fail to find the cookie in the map. | 183 // Returns NULL if we fail to find the cookie in the map. |
179 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); | 184 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); |
180 | 185 |
181 // Overridden from views::WidgetWin: | 186 // Overridden from views::WidgetWin: |
182 virtual views::Window* GetWindow(); | 187 virtual views::Window* GetWindow(); |
183 | 188 |
184 // Handles the specified |accelerator| being pressed. | 189 // Handles the specified |accelerator| being pressed. |
185 bool AcceleratorPressed(const views::Accelerator& accelerator); | 190 bool AcceleratorPressed(const views::Accelerator& accelerator); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return false; | 396 return false; |
392 } | 397 } |
393 | 398 |
394 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, | 399 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, |
395 bool* proceed_to_fire_unload) { | 400 bool* proceed_to_fire_unload) { |
396 NOTREACHED(); | 401 NOTREACHED(); |
397 } | 402 } |
398 }; | 403 }; |
399 | 404 |
400 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ | 405 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
OLD | NEW |