| 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" | |
| 18 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" | 17 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" |
| 19 #include "chrome/browser/ui/views/infobars/infobar_container.h" | 18 #include "chrome/browser/ui/views/infobars/infobar_container.h" |
| 20 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 19 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
| 21 #include "content/browser/tab_contents/tab_contents_delegate.h" | 20 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 22 #include "content/common/navigation_types.h" | 21 #include "content/common/navigation_types.h" |
| 23 #include "content/common/notification_observer.h" | 22 #include "content/common/notification_observer.h" |
| 24 #include "content/common/notification_registrar.h" | 23 #include "content/common/notification_registrar.h" |
| 25 #include "views/accelerator.h" | 24 #include "views/accelerator.h" |
| 26 #include "views/widget/widget_win.h" | 25 #include "views/widget/widget_win.h" |
| 27 | 26 |
| 28 class AutomationProvider; | 27 class AutomationProvider; |
| 29 class Browser; | 28 class Browser; |
| 30 class Profile; | 29 class Profile; |
| 31 class TabContentsContainer; | 30 class TabContentsContainer; |
| 32 class TabContentsWrapper; | 31 class TabContentsWrapper; |
| 33 class RenderViewContextMenuViews; | 32 class RenderViewContextMenuViews; |
| 34 struct NavigationInfo; | 33 struct NavigationInfo; |
| 35 | 34 |
| 36 namespace ui { | 35 namespace ui { |
| 37 class ViewProp; | 36 class ViewProp; |
| 38 } | 37 } |
| 39 | 38 |
| 40 // This class serves as the container window for an external tab. | 39 // This class serves as the container window for an external tab. |
| 41 // An external tab is a Chrome tab that is meant to displayed in an | 40 // An external tab is a Chrome tab that is meant to displayed in an |
| 42 // external process. This class provides the FocusManger needed by the | 41 // external process. This class provides the FocusManger needed by the |
| 43 // TabContents as well as an implementation of TabContentsDelegate. | 42 // TabContents as well as an implementation of TabContentsDelegate. |
| 44 class ExternalTabContainer : public TabContentsDelegate, | 43 class ExternalTabContainer : public TabContentsDelegate, |
| 45 public DownloadTabHelperDelegate, | |
| 46 public NotificationObserver, | 44 public NotificationObserver, |
| 47 public views::WidgetWin, | 45 public views::WidgetWin, |
| 48 public base::RefCounted<ExternalTabContainer>, | 46 public base::RefCounted<ExternalTabContainer>, |
| 49 public views::AcceleratorTarget, | 47 public views::AcceleratorTarget, |
| 50 public InfoBarContainer::Delegate, | 48 public InfoBarContainer::Delegate, |
| 51 public BrowserBubbleHost { | 49 public BrowserBubbleHost { |
| 52 public: | 50 public: |
| 53 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; | 51 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; |
| 54 | 52 |
| 55 ExternalTabContainer(AutomationProvider* automation, | 53 ExternalTabContainer(AutomationProvider* automation, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 const std::string& target); | 135 const std::string& target); |
| 138 virtual bool IsExternalTabContainer() const; | 136 virtual bool IsExternalTabContainer() const; |
| 139 virtual gfx::NativeWindow GetFrameNativeWindow(); | 137 virtual gfx::NativeWindow GetFrameNativeWindow(); |
| 140 | 138 |
| 141 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 139 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 142 bool* is_keyboard_shortcut); | 140 bool* is_keyboard_shortcut); |
| 143 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 141 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 144 | 142 |
| 145 virtual bool TakeFocus(bool reverse); | 143 virtual bool TakeFocus(bool reverse); |
| 146 | 144 |
| 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 | |
| 181 // Returns the ExternalTabContainer instance associated with the cookie | 176 // Returns the ExternalTabContainer instance associated with the cookie |
| 182 // passed in. It also erases the corresponding reference from the map. | 177 // passed in. It also erases the corresponding reference from the map. |
| 183 // Returns NULL if we fail to find the cookie in the map. | 178 // Returns NULL if we fail to find the cookie in the map. |
| 184 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); | 179 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); |
| 185 | 180 |
| 186 // Overridden from views::WidgetWin: | 181 // Overridden from views::WidgetWin: |
| 187 virtual views::Window* GetWindow(); | 182 virtual views::Window* GetWindow(); |
| 188 | 183 |
| 189 // Handles the specified |accelerator| being pressed. | 184 // Handles the specified |accelerator| being pressed. |
| 190 bool AcceleratorPressed(const views::Accelerator& accelerator); | 185 bool AcceleratorPressed(const views::Accelerator& accelerator); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 return false; | 391 return false; |
| 397 } | 392 } |
| 398 | 393 |
| 399 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, | 394 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, |
| 400 bool* proceed_to_fire_unload) { | 395 bool* proceed_to_fire_unload) { |
| 401 NOTREACHED(); | 396 NOTREACHED(); |
| 402 } | 397 } |
| 403 }; | 398 }; |
| 404 | 399 |
| 405 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ | 400 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
| OLD | NEW |