| 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/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "chrome/browser/automation/automation_resource_message_filter.h" | 16 #include "chrome/browser/automation/automation_resource_message_filter.h" |
| 17 #include "chrome/browser/infobars/infobar_container.h" | 17 #include "chrome/browser/infobars/infobar_container.h" |
| 18 #include "chrome/browser/net/chrome_url_request_context.h" | 18 #include "chrome/browser/net/chrome_url_request_context.h" |
| 19 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 19 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 20 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" | 20 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" |
| 21 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 21 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
| 22 #include "content/browser/tab_contents/tab_contents_delegate.h" | 22 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 23 #include "content/browser/tab_contents/tab_contents_observer.h" | 23 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 24 #include "content/public/browser/navigation_types.h" | 24 #include "content/public/browser/navigation_types.h" |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "views/accelerator.h" | 27 #include "ui/base/models/accelerator.h" |
| 28 #include "views/widget/native_widget_win.h" | 28 #include "views/widget/native_widget_win.h" |
| 29 | 29 |
| 30 class AutomationProvider; | 30 class AutomationProvider; |
| 31 class Browser; | 31 class Browser; |
| 32 class Profile; | 32 class Profile; |
| 33 class TabContentsContainer; | 33 class TabContentsContainer; |
| 34 class TabContentsWrapper; | 34 class TabContentsWrapper; |
| 35 class RenderViewContextMenuViews; | 35 class RenderViewContextMenuViews; |
| 36 struct NavigationInfo; | 36 struct NavigationInfo; |
| 37 | 37 |
| 38 namespace ui { | 38 namespace ui { |
| 39 class ViewProp; | 39 class ViewProp; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // This class serves as the container window for an external tab. | 42 // This class serves as the container window for an external tab. |
| 43 // An external tab is a Chrome tab that is meant to displayed in an | 43 // An external tab is a Chrome tab that is meant to displayed in an |
| 44 // external process. This class provides the FocusManger needed by the | 44 // external process. This class provides the FocusManger needed by the |
| 45 // TabContents as well as an implementation of TabContentsDelegate. | 45 // TabContents as well as an implementation of TabContentsDelegate. |
| 46 class ExternalTabContainer : public TabContentsDelegate, | 46 class ExternalTabContainer : public TabContentsDelegate, |
| 47 public TabContentsObserver, | 47 public TabContentsObserver, |
| 48 public content::NotificationObserver, | 48 public content::NotificationObserver, |
| 49 public views::NativeWidgetWin, | 49 public views::NativeWidgetWin, |
| 50 public base::RefCounted<ExternalTabContainer>, | 50 public base::RefCounted<ExternalTabContainer>, |
| 51 public views::AcceleratorTarget, | 51 public ui::AcceleratorTarget, |
| 52 public InfoBarContainer::Delegate, | 52 public InfoBarContainer::Delegate, |
| 53 public BrowserBubbleHost, | 53 public BrowserBubbleHost, |
| 54 public BlockedContentTabHelperDelegate { | 54 public BlockedContentTabHelperDelegate { |
| 55 public: | 55 public: |
| 56 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; | 56 typedef std::map<uintptr_t, scoped_refptr<ExternalTabContainer> > PendingTabs; |
| 57 | 57 |
| 58 ExternalTabContainer(AutomationProvider* automation, | 58 ExternalTabContainer(AutomationProvider* automation, |
| 59 AutomationResourceMessageFilter* filter); | 59 AutomationResourceMessageFilter* filter); |
| 60 | 60 |
| 61 TabContents* tab_contents() const; | 61 TabContents* tab_contents() const; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 virtual void Observe(int type, | 202 virtual void Observe(int type, |
| 203 const content::NotificationSource& source, | 203 const content::NotificationSource& source, |
| 204 const content::NotificationDetails& details); | 204 const content::NotificationDetails& details); |
| 205 | 205 |
| 206 // Returns the ExternalTabContainer instance associated with the cookie | 206 // Returns the ExternalTabContainer instance associated with the cookie |
| 207 // passed in. It also erases the corresponding reference from the map. | 207 // passed in. It also erases the corresponding reference from the map. |
| 208 // Returns NULL if we fail to find the cookie in the map. | 208 // Returns NULL if we fail to find the cookie in the map. |
| 209 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); | 209 static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); |
| 210 | 210 |
| 211 // Handles the specified |accelerator| being pressed. | 211 // Handles the specified |accelerator| being pressed. |
| 212 bool AcceleratorPressed(const views::Accelerator& accelerator); | 212 bool AcceleratorPressed(const ui::Accelerator& accelerator); |
| 213 | 213 |
| 214 bool pending() const { | 214 bool pending() const { |
| 215 return pending_; | 215 return pending_; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void set_pending(bool pending) { | 218 void set_pending(bool pending) { |
| 219 pending_ = pending; | 219 pending_ = pending; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void set_is_popup_window(bool is_popup_window) { | 222 void set_is_popup_window(bool is_popup_window) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // Allows us to run tasks on the ExternalTabContainer instance which are | 304 // Allows us to run tasks on the ExternalTabContainer instance which are |
| 305 // bound by its lifetime. | 305 // bound by its lifetime. |
| 306 ScopedRunnableMethodFactory<ExternalTabContainer> external_method_factory_; | 306 ScopedRunnableMethodFactory<ExternalTabContainer> external_method_factory_; |
| 307 | 307 |
| 308 // The URL request context to be used for this tab. Can be NULL. | 308 // The URL request context to be used for this tab. Can be NULL. |
| 309 scoped_refptr<ChromeURLRequestContextGetter> request_context_; | 309 scoped_refptr<ChromeURLRequestContextGetter> request_context_; |
| 310 | 310 |
| 311 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 311 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
| 312 | 312 |
| 313 // A mapping between accelerators and commands. | 313 // A mapping between accelerators and commands. |
| 314 std::map<views::Accelerator, int> accelerator_table_; | 314 std::map<ui::Accelerator, int> accelerator_table_; |
| 315 | 315 |
| 316 // Top level navigations received for a tab while it is waiting for an ack | 316 // Top level navigations received for a tab while it is waiting for an ack |
| 317 // from the external host go here. Scenario is a window.open executes on a | 317 // from the external host go here. Scenario is a window.open executes on a |
| 318 // page in ChromeFrame. A new TabContents is created and the current | 318 // page in ChromeFrame. A new TabContents is created and the current |
| 319 // ExternalTabContainer is notified via AddNewContents. At this point we | 319 // ExternalTabContainer is notified via AddNewContents. At this point we |
| 320 // send off an attach tab request to the host browser. Before the host | 320 // send off an attach tab request to the host browser. Before the host |
| 321 // browser sends over the ack, we receive a top level URL navigation for the | 321 // browser sends over the ack, we receive a top level URL navigation for the |
| 322 // new tab, which needs to be routed over the correct automation channel. | 322 // new tab, which needs to be routed over the correct automation channel. |
| 323 // We receive the automation channel only when the external host acks the | 323 // We receive the automation channel only when the external host acks the |
| 324 // attach tab request. | 324 // attach tab request. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 return false; | 413 return false; |
| 414 } | 414 } |
| 415 | 415 |
| 416 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, | 416 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, |
| 417 bool* proceed_to_fire_unload) { | 417 bool* proceed_to_fire_unload) { |
| 418 NOTREACHED(); | 418 NOTREACHED(); |
| 419 } | 419 } |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ | 422 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
| OLD | NEW |