OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 #include <map> | 12 |
11 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
12 #include "chrome/browser/automation/automation_resource_message_filter.h" | 14 #include "chrome/browser/automation/automation_resource_message_filter.h" |
13 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
14 #include "chrome/browser/net/chrome_url_request_context.h" | 16 #include "chrome/browser/net/chrome_url_request_context.h" |
15 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 17 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
16 #include "chrome/browser/views/frame/browser_bubble_host.h" | 18 #include "chrome/browser/views/frame/browser_bubble_host.h" |
17 #include "chrome/browser/views/infobars/infobar_container.h" | 19 #include "chrome/browser/views/infobars/infobar_container.h" |
18 #include "chrome/browser/views/unhandled_keyboard_event_handler.h" | 20 #include "chrome/browser/views/unhandled_keyboard_event_handler.h" |
19 #include "chrome/common/navigation_types.h" | 21 #include "chrome/common/navigation_types.h" |
20 #include "chrome/common/notification_observer.h" | 22 #include "chrome/common/notification_observer.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 61 |
60 bool Init(Profile* profile, | 62 bool Init(Profile* profile, |
61 HWND parent, | 63 HWND parent, |
62 const gfx::Rect& bounds, | 64 const gfx::Rect& bounds, |
63 DWORD style, | 65 DWORD style, |
64 bool load_requests_via_automation, | 66 bool load_requests_via_automation, |
65 bool handle_top_level_requests, | 67 bool handle_top_level_requests, |
66 TabContents* existing_tab_contents, | 68 TabContents* existing_tab_contents, |
67 const GURL& initial_url, | 69 const GURL& initial_url, |
68 const GURL& referrer, | 70 const GURL& referrer, |
69 bool infobars_enabled); | 71 bool infobars_enabled, |
| 72 bool supports_full_tab_mode); |
70 | 73 |
71 // Unhook the keystroke listener and notify about the closing TabContents. | 74 // Unhook the keystroke listener and notify about the closing TabContents. |
72 // This function gets called from three places, which is fine. | 75 // This function gets called from three places, which is fine. |
73 // 1. OnFinalMessage | 76 // 1. OnFinalMessage |
74 // 2. In the destructor. | 77 // 2. In the destructor. |
75 // 3. In AutomationProvider::CreateExternalTab | 78 // 3. In AutomationProvider::CreateExternalTab |
76 void Uninitialize(); | 79 void Uninitialize(); |
77 | 80 |
78 // Used to reinitialize the automation channel and related information | 81 // Used to reinitialize the automation channel and related information |
79 // for this container. Typically used when an ExternalTabContainer | 82 // for this container. Typically used when an ExternalTabContainer |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // InfoBarContainer::Delegate overrides | 205 // InfoBarContainer::Delegate overrides |
203 virtual void InfoBarSizeChanged(bool is_animating); | 206 virtual void InfoBarSizeChanged(bool is_animating); |
204 | 207 |
205 virtual void TabContentsCreated(TabContents* new_contents); | 208 virtual void TabContentsCreated(TabContents* new_contents); |
206 | 209 |
207 virtual bool infobars_enabled(); | 210 virtual bool infobars_enabled(); |
208 | 211 |
209 void RunUnloadHandlers(IPC::Message* reply_message); | 212 void RunUnloadHandlers(IPC::Message* reply_message); |
210 | 213 |
211 protected: | 214 protected: |
| 215 ~ExternalTabContainer(); |
212 // Overridden from views::WidgetWin: | 216 // Overridden from views::WidgetWin: |
213 virtual LRESULT OnCreate(LPCREATESTRUCT create_struct); | 217 virtual LRESULT OnCreate(LPCREATESTRUCT create_struct); |
214 virtual void OnDestroy(); | 218 virtual void OnDestroy(); |
215 virtual void OnFinalMessage(HWND window); | 219 virtual void OnFinalMessage(HWND window); |
216 | 220 |
217 bool InitNavigationInfo(IPC::NavigationInfo* nav_info, | 221 bool InitNavigationInfo(IPC::NavigationInfo* nav_info, |
218 NavigationType::Type nav_type, | 222 NavigationType::Type nav_type, |
219 int relative_offset); | 223 int relative_offset); |
220 void Navigate(const GURL& url, const GURL& referrer); | 224 void Navigate(const GURL& url, const GURL& referrer); |
221 | 225 |
222 private: | |
223 friend class base::RefCounted<ExternalTabContainer>; | 226 friend class base::RefCounted<ExternalTabContainer>; |
224 | 227 |
225 ~ExternalTabContainer(); | |
226 | |
227 // Helper resource automation registration method, allowing registration of | 228 // Helper resource automation registration method, allowing registration of |
228 // pending RenderViewHosts. | 229 // pending RenderViewHosts. |
229 void RegisterRenderViewHostForAutomation(RenderViewHost* render_view_host, | 230 void RegisterRenderViewHostForAutomation(RenderViewHost* render_view_host, |
230 bool pending_view); | 231 bool pending_view); |
231 | 232 |
232 // Top level navigations received for a tab while it is waiting for an ack | 233 // Top level navigations received for a tab while it is waiting for an ack |
233 // from the external host go here. Scenario is a window.open executes on a | 234 // from the external host go here. Scenario is a window.open executes on a |
234 // page in ChromeFrame. A new TabContents is created and the current | 235 // page in ChromeFrame. A new TabContents is created and the current |
235 // ExternalTabContainer is notified via AddNewContents. At this point we | 236 // ExternalTabContainer is notified via AddNewContents. At this point we |
236 // send off an attach tab request to the host browser. Before the host | 237 // send off an attach tab request to the host browser. Before the host |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 320 |
320 // Set to true if the ExternalTabContainer if infobars should be enabled. | 321 // Set to true if the ExternalTabContainer if infobars should be enabled. |
321 bool infobars_enabled_; | 322 bool infobars_enabled_; |
322 | 323 |
323 views::FocusManager* focus_manager_; | 324 views::FocusManager* focus_manager_; |
324 | 325 |
325 views::View* external_tab_view_; | 326 views::View* external_tab_view_; |
326 | 327 |
327 IPC::Message* unload_reply_message_; | 328 IPC::Message* unload_reply_message_; |
328 | 329 |
| 330 // set to true if the host needs to get notified of all top level navigations |
| 331 // in this page. This typically applies to hosts which would render the new |
| 332 // page without chrome frame. |
| 333 bool route_all_top_level_navigations_; |
| 334 |
329 DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); | 335 DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); |
330 }; | 336 }; |
331 | 337 |
| 338 // This class is instantiated for handling requests to open popups for external |
| 339 // tabs hosted in browsers which need to be notified about all top level |
| 340 // navigations. An instance of this class is created for handling window.open |
| 341 // or link navigations with target blank, etc. |
| 342 class TemporaryPopupExternalTabContainer : public ExternalTabContainer { |
| 343 public: |
| 344 TemporaryPopupExternalTabContainer(AutomationProvider* automation, |
| 345 AutomationResourceMessageFilter* filter); |
| 346 virtual ~TemporaryPopupExternalTabContainer(); |
| 347 |
| 348 virtual bool OnGoToEntryOffset(int offset) { |
| 349 NOTREACHED(); |
| 350 return false; |
| 351 } |
| 352 |
| 353 virtual bool ProcessUnhandledKeyStroke(HWND window, UINT message, |
| 354 WPARAM wparam, LPARAM lparam) { |
| 355 NOTREACHED(); |
| 356 return false; |
| 357 } |
| 358 |
| 359 virtual void Observe(NotificationType type, const NotificationSource& source, |
| 360 const NotificationDetails& details) {} |
| 361 |
| 362 virtual void OpenURLFromTab(TabContents* source, const GURL& url, |
| 363 const GURL& referrer, |
| 364 WindowOpenDisposition disposition, |
| 365 PageTransition::Type transition); |
| 366 |
| 367 virtual void NavigationStateChanged(const TabContents* source, |
| 368 unsigned changed_flags) { |
| 369 NOTREACHED(); |
| 370 } |
| 371 |
| 372 virtual void CloseContents(TabContents* source) { |
| 373 NOTREACHED(); |
| 374 } |
| 375 |
| 376 virtual void UpdateTargetURL(TabContents* source, const GURL& url) { |
| 377 NOTREACHED(); |
| 378 } |
| 379 |
| 380 void ForwardMessageToExternalHost(const std::string& message, |
| 381 const std::string& origin, |
| 382 const std::string& target) { |
| 383 NOTREACHED(); |
| 384 } |
| 385 |
| 386 virtual bool TakeFocus(bool reverse) { |
| 387 NOTREACHED(); |
| 388 return false; |
| 389 } |
| 390 |
| 391 virtual bool HandleContextMenu(const ContextMenuParams& params) { |
| 392 NOTREACHED(); |
| 393 return false; |
| 394 } |
| 395 |
| 396 virtual void BeforeUnloadFired(TabContents* tab, bool proceed, |
| 397 bool* proceed_to_fire_unload) { |
| 398 NOTREACHED(); |
| 399 } |
| 400 }; |
| 401 |
332 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ | 402 #endif // CHROME_BROWSER_EXTERNAL_TAB_CONTAINER_WIN_H_ |
OLD | NEW |