| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_H_ | 5 #ifndef CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_H_ | 6 #define CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| 11 #include <atlmisc.h> | 11 #include <atlmisc.h> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/notification_observer.h" | 17 #include "chrome/common/notification_observer.h" |
| 18 #include "chrome/common/notification_registrar.h" | 18 #include "chrome/common/notification_registrar.h" |
| 19 #include "chrome/views/focus/focus_manager.h" | 19 #include "chrome/views/focus/focus_manager.h" |
| 20 #include "chrome/views/widget/root_view.h" | 20 #include "chrome/views/widget/root_view.h" |
| 21 #include "chrome/views/widget/widget.h" | 21 #include "chrome/views/widget/widget.h" |
| 22 | 22 |
| 23 class AutomationProvider; | 23 class AutomationProvider; |
| 24 class TabContents; | 24 class WebContents; |
| 25 class Profile; | 25 class Profile; |
| 26 class TabContentsContainerView; | 26 class TabContentsContainerView; |
| 27 // This class serves as the container window for an external tab. | 27 // This class serves as the container window for an external tab. |
| 28 // An external tab is a Chrome tab that is meant to displayed in an | 28 // An external tab is a Chrome tab that is meant to displayed in an |
| 29 // external process. This class provides the FocusManger needed by the | 29 // external process. This class provides the FocusManger needed by the |
| 30 // TabContents as well as an implementation of TabContentsDelagate. | 30 // TabContents as well as an implementation of TabContentsDelagate. |
| 31 // It also implements Container | 31 // It also implements Container |
| 32 class ExternalTabContainer : public TabContentsDelegate, | 32 class ExternalTabContainer : public TabContentsDelegate, |
| 33 public NotificationObserver, | 33 public NotificationObserver, |
| 34 public views::Widget, | 34 public views::Widget, |
| 35 public views::KeystrokeListener, | 35 public views::KeystrokeListener, |
| 36 public CWindowImpl<ExternalTabContainer, | 36 public CWindowImpl<ExternalTabContainer, |
| 37 CWindow, | 37 CWindow, |
| 38 CWinTraits<WS_POPUP | | 38 CWinTraits<WS_POPUP | |
| 39 WS_CLIPCHILDREN>> { | 39 WS_CLIPCHILDREN>> { |
| 40 public: | 40 public: |
| 41 BEGIN_MSG_MAP(ExternalTabContainer) | 41 BEGIN_MSG_MAP(ExternalTabContainer) |
| 42 MESSAGE_HANDLER(WM_SIZE, OnSize) | 42 MESSAGE_HANDLER(WM_SIZE, OnSize) |
| 43 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) | 43 MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) |
| 44 END_MSG_MAP() | 44 END_MSG_MAP() |
| 45 | 45 |
| 46 DECLARE_WND_CLASS(chrome::kExternalTabWindowClass) | 46 DECLARE_WND_CLASS(chrome::kExternalTabWindowClass) |
| 47 | 47 |
| 48 ExternalTabContainer(AutomationProvider* automation); | 48 ExternalTabContainer(AutomationProvider* automation); |
| 49 ~ExternalTabContainer(); | 49 ~ExternalTabContainer(); |
| 50 | 50 |
| 51 TabContents* tab_contents() const { | 51 WebContents* tab_contents() const { |
| 52 return tab_contents_; | 52 return tab_contents_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool Init(Profile* profile, HWND parent, const gfx::Rect& dimensions, | 55 bool Init(Profile* profile, HWND parent, const gfx::Rect& dimensions, |
| 56 unsigned int style); | 56 unsigned int style); |
| 57 | 57 |
| 58 // This function gets called from two places, which is fine. | 58 // This function gets called from two places, which is fine. |
| 59 // 1. OnFinalMessage | 59 // 1. OnFinalMessage |
| 60 // 2. In the destructor. | 60 // 2. In the destructor. |
| 61 bool Uninitialize(HWND window); | 61 bool Uninitialize(HWND window); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // hosts the given tab window. | 134 // hosts the given tab window. |
| 135 static ExternalTabContainer* GetContainerForTab(HWND tab_window); | 135 static ExternalTabContainer* GetContainerForTab(HWND tab_window); |
| 136 | 136 |
| 137 protected: | 137 protected: |
| 138 LRESULT OnSize(UINT, WPARAM, LPARAM, BOOL& handled); | 138 LRESULT OnSize(UINT, WPARAM, LPARAM, BOOL& handled); |
| 139 LRESULT OnSetFocus(UINT msg, WPARAM wp, LPARAM lp, BOOL& handled); | 139 LRESULT OnSetFocus(UINT msg, WPARAM wp, LPARAM lp, BOOL& handled); |
| 140 void OnDestroy(); | 140 void OnDestroy(); |
| 141 void OnFinalMessage(HWND window); | 141 void OnFinalMessage(HWND window); |
| 142 | 142 |
| 143 protected: | 143 protected: |
| 144 TabContents *tab_contents_; | 144 WebContents* tab_contents_; |
| 145 scoped_refptr<AutomationProvider> automation_; | 145 scoped_refptr<AutomationProvider> automation_; |
| 146 | 146 |
| 147 NotificationRegistrar registrar_; | 147 NotificationRegistrar registrar_; |
| 148 | 148 |
| 149 // Root view | 149 // Root view |
| 150 views::RootView root_view_; | 150 views::RootView root_view_; |
| 151 // The accelerator table of the external host. | 151 // The accelerator table of the external host. |
| 152 HACCEL external_accel_table_; | 152 HACCEL external_accel_table_; |
| 153 unsigned int external_accel_entry_count_; | 153 unsigned int external_accel_entry_count_; |
| 154 // A view to handle focus cycling | 154 // A view to handle focus cycling |
| 155 TabContentsContainerView* tab_contents_container_; | 155 TabContentsContainerView* tab_contents_container_; |
| 156 |
| 156 private: | 157 private: |
| 157 // A failed navigation like a 404 is followed in chrome with a success | 158 // A failed navigation like a 404 is followed in chrome with a success |
| 158 // navigation for the 404 page. We need to ignore the next navigation | 159 // navigation for the 404 page. We need to ignore the next navigation |
| 159 // to avoid confusing the clients of the external tab. This member variable | 160 // to avoid confusing the clients of the external tab. This member variable |
| 160 // is set when we need to ignore the next load notification. | 161 // is set when we need to ignore the next load notification. |
| 161 bool ignore_next_load_notification_; | 162 bool ignore_next_load_notification_; |
| 162 | 163 |
| 163 DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); | 164 DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_H__ | 167 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_H_ |
| OLD | NEW |