Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: chrome/browser/external_tab/external_tab_container_win.h

Issue 9978015: Make browser_handles_top_level_requests synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ExternalTabContainer::ShouldIgnoreNavigation returns true if is_content_initiated Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTERNAL_TAB_CONTAINER_WIN_H_ 5 #ifndef CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_WIN_H_
6 #define CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_WIN_H_ 6 #define CHROME_BROWSER_EXTERNAL_TAB_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 "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/automation/automation_resource_message_filter.h" 17 #include "chrome/browser/automation/automation_resource_message_filter.h"
18 #include "chrome/browser/infobars/infobar_container.h" 18 #include "chrome/browser/infobars/infobar_container.h"
19 #include "chrome/browser/net/chrome_url_request_context.h" 19 #include "chrome/browser/net/chrome_url_request_context.h"
20 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h" 20 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. 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/public/browser/navigation_type.h" 22 #include "content/public/browser/navigation_type.h"
23 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "content/public/browser/web_contents_delegate.h" 25 #include "content/public/browser/web_contents_delegate.h"
26 #include "content/public/browser/web_contents_observer.h" 26 #include "content/public/browser/web_contents_observer.h"
27 #include "content/public/common/referrer.h"
27 #include "ui/base/accelerators/accelerator.h" 28 #include "ui/base/accelerators/accelerator.h"
28 #include "ui/views/widget/native_widget_win.h" 29 #include "ui/views/widget/native_widget_win.h"
29 30
30 class AutomationProvider; 31 class AutomationProvider;
31 class Browser; 32 class Browser;
32 class Profile; 33 class Profile;
33 class TabContentsContainer; 34 class TabContentsContainer;
34 class TabContentsWrapper; 35 class TabContentsWrapper;
35 class RenderViewContextMenuViews; 36 class RenderViewContextMenuViews;
36 struct NavigationInfo; 37 struct NavigationInfo;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 gfx::NativeView native_window); 116 gfx::NativeView native_window);
116 117
117 // A helper method that retrieves the ExternalTabContainer object that 118 // A helper method that retrieves the ExternalTabContainer object that
118 // hosts the given tab window. 119 // hosts the given tab window.
119 static ExternalTabContainer* GetContainerForTab(HWND tab_window); 120 static ExternalTabContainer* GetContainerForTab(HWND tab_window);
120 121
121 // Overridden from content::WebContentsDelegate: 122 // Overridden from content::WebContentsDelegate:
122 virtual content::WebContents* OpenURLFromTab( 123 virtual content::WebContents* OpenURLFromTab(
123 content::WebContents* source, 124 content::WebContents* source,
124 const content::OpenURLParams& params) OVERRIDE; 125 const content::OpenURLParams& params) OVERRIDE;
126 virtual bool ShouldIgnoreNavigation(
127 content::WebContents* source,
128 const GURL& url,
129 const content::Referrer& referrer,
130 WindowOpenDisposition disposition,
131 bool is_content_initiated,
132 content::PageTransition transition_type) OVERRIDE;
125 virtual void NavigationStateChanged(const content::WebContents* source, 133 virtual void NavigationStateChanged(const content::WebContents* source,
126 unsigned changed_flags) OVERRIDE; 134 unsigned changed_flags) OVERRIDE;
127 virtual void AddNewContents(content::WebContents* source, 135 virtual void AddNewContents(content::WebContents* source,
128 content::WebContents* new_contents, 136 content::WebContents* new_contents,
129 WindowOpenDisposition disposition, 137 WindowOpenDisposition disposition,
130 const gfx::Rect& initial_pos, 138 const gfx::Rect& initial_pos,
131 bool user_gesture) OVERRIDE; 139 bool user_gesture) OVERRIDE;
132 virtual void CloseContents(content::WebContents* source) OVERRIDE; 140 virtual void CloseContents(content::WebContents* source) OVERRIDE;
133 virtual void MoveContents(content::WebContents* source, 141 virtual void MoveContents(content::WebContents* source,
134 const gfx::Rect& pos) OVERRIDE; 142 const gfx::Rect& pos) OVERRIDE;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 281
274 // Sends over pending Open URL requests to the external host. 282 // Sends over pending Open URL requests to the external host.
275 void ServicePendingOpenURLRequests(); 283 void ServicePendingOpenURLRequests();
276 284
277 // Scheduled as a task in ExternalTabContainer::Reinitialize 285 // Scheduled as a task in ExternalTabContainer::Reinitialize
278 void OnReinitialize(); 286 void OnReinitialize();
279 287
280 // Creates and initializes the view hierarchy for this ExternalTabContainer. 288 // Creates and initializes the view hierarchy for this ExternalTabContainer.
281 void SetupExternalTabView(); 289 void SetupExternalTabView();
282 290
291 // Send a URL open request to the external host.
292 content::WebContents* OpenUrlInExtenalHost(
293 content::WebContents* source,
294 const GURL& url,
295 WindowOpenDisposition disposition,
296 const content::Referrer& referrer);
297
283 scoped_ptr<TabContentsWrapper> tab_contents_; 298 scoped_ptr<TabContentsWrapper> tab_contents_;
284 scoped_refptr<AutomationProvider> automation_; 299 scoped_refptr<AutomationProvider> automation_;
285 300
286 content::NotificationRegistrar registrar_; 301 content::NotificationRegistrar registrar_;
287 302
288 // A view to handle focus cycling 303 // A view to handle focus cycling
289 TabContentsContainer* tab_contents_container_; 304 TabContentsContainer* tab_contents_container_;
290 305
291 int tab_handle_; 306 int tab_handle_;
292 // A failed navigation like a 404 is followed in chrome with a success 307 // A failed navigation like a 404 is followed in chrome with a success
(...skipping 22 matching lines...) Expand all
315 base::WeakPtrFactory<ExternalTabContainer> weak_factory_; 330 base::WeakPtrFactory<ExternalTabContainer> weak_factory_;
316 331
317 // The URL request context to be used for this tab. Can be NULL. 332 // The URL request context to be used for this tab. Can be NULL.
318 scoped_refptr<ChromeURLRequestContextGetter> request_context_; 333 scoped_refptr<ChromeURLRequestContextGetter> request_context_;
319 334
320 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 335 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
321 336
322 // A mapping between accelerators and commands. 337 // A mapping between accelerators and commands.
323 std::map<ui::Accelerator, int> accelerator_table_; 338 std::map<ui::Accelerator, int> accelerator_table_;
324 339
340 struct PendingOpenUrlRequest {
341 GURL url;
342 WindowOpenDisposition disposition;
343 content::Referrer referrer;
344 };
325 // Top level navigations received for a tab while it is waiting for an ack 345 // Top level navigations received for a tab while it is waiting for an ack
326 // from the external host go here. Scenario is a window.open executes on a 346 // from the external host go here. Scenario is a window.open executes on a
327 // page in ChromeFrame. A new TabContents is created and the current 347 // page in ChromeFrame. A new TabContents is created and the current
328 // ExternalTabContainer is notified via AddNewContents. At this point we 348 // ExternalTabContainer is notified via AddNewContents. At this point we
329 // send off an attach tab request to the host browser. Before the host 349 // send off an attach tab request to the host browser. Before the host
330 // browser sends over the ack, we receive a top level URL navigation for the 350 // browser sends over the ack, we receive a top level URL navigation for the
331 // new tab, which needs to be routed over the correct automation channel. 351 // new tab, which needs to be routed over the correct automation channel.
332 // We receive the automation channel only when the external host acks the 352 // We receive the automation channel only when the external host acks the
333 // attach tab request. 353 // attach tab request.
334 // Contains the list of URL requests which are pending waiting for an ack 354 // Contains the list of URL requests which are pending waiting for an ack
335 // from the external host. 355 // from the external host.
336 std::vector<content::OpenURLParams> pending_open_url_requests_; 356 std::vector<PendingOpenUrlRequest> pending_open_url_requests_;
337 357
338 // Set to true if the ExternalTabContainer instance is waiting for an ack 358 // Set to true if the ExternalTabContainer instance is waiting for an ack
339 // from the host. 359 // from the host.
340 bool pending_; 360 bool pending_;
341 361
342 views::FocusManager* focus_manager_; 362 views::FocusManager* focus_manager_;
343 363
344 views::View* external_tab_view_; 364 views::View* external_tab_view_;
345 365
346 IPC::Message* unload_reply_message_; 366 IPC::Message* unload_reply_message_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return false; 436 return false;
417 } 437 }
418 438
419 virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, 439 virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed,
420 bool* proceed_to_fire_unload) { 440 bool* proceed_to_fire_unload) {
421 NOTREACHED(); 441 NOTREACHED();
422 } 442 }
423 }; 443 };
424 444
425 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_WIN_H_ 445 #endif // CHROME_BROWSER_EXTERNAL_TAB_EXTERNAL_TAB_CONTAINER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698