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

Side by Side Diff: chrome/browser/ui/constrained_window_tab_helper.cc

Issue 10546106: TabContentsWrapper -> TabContents, part 53. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 #include "chrome/browser/ui/constrained_window_tab_helper.h" 5 #include "chrome/browser/ui/constrained_window_tab_helper.h"
6 6
7 #include "chrome/browser/ui/constrained_window.h" 7 #include "chrome/browser/ui/constrained_window.h"
8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" 8 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "content/public/browser/navigation_details.h" 11 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/render_widget_host_view.h" 14 #include "content/public/browser/render_widget_host_view.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "net/base/registry_controlled_domain.h" 16 #include "net/base/registry_controlled_domain.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 19
20 ConstrainedWindowTabHelper::ConstrainedWindowTabHelper( 20 ConstrainedWindowTabHelper::ConstrainedWindowTabHelper(
21 TabContentsWrapper* wrapper) 21 TabContents* tab_contents)
22 : content::WebContentsObserver(wrapper->web_contents()), 22 : content::WebContentsObserver(tab_contents->web_contents()),
23 wrapper_(wrapper), 23 tab_contents_(tab_contents),
24 delegate_(NULL) { 24 delegate_(NULL) {
25 } 25 }
26 26
27 ConstrainedWindowTabHelper::~ConstrainedWindowTabHelper() { 27 ConstrainedWindowTabHelper::~ConstrainedWindowTabHelper() {
28 DCHECK(child_windows_.empty()); 28 DCHECK(child_windows_.empty());
29 } 29 }
30 30
31 void ConstrainedWindowTabHelper::AddConstrainedDialog( 31 void ConstrainedWindowTabHelper::AddConstrainedDialog(
32 ConstrainedWindow* window) { 32 ConstrainedWindow* window) {
33 child_windows_.push_back(window); 33 child_windows_.push_back(window);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 // RenderViewHost may be NULL during shutdown. 80 // RenderViewHost may be NULL during shutdown.
81 content::RenderViewHost* host = contents->GetRenderViewHost(); 81 content::RenderViewHost* host = contents->GetRenderViewHost();
82 if (host) { 82 if (host) {
83 host->SetIgnoreInputEvents(blocked); 83 host->SetIgnoreInputEvents(blocked);
84 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized( 84 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized(
85 host->GetRoutingID(), blocked)); 85 host->GetRoutingID(), blocked));
86 } 86 }
87 if (delegate_) 87 if (delegate_)
88 delegate_->SetTabContentBlocked(wrapper_, blocked); 88 delegate_->SetTabContentBlocked(tab_contents_, blocked);
89 } 89 }
90 90
91 void ConstrainedWindowTabHelper::DidNavigateMainFrame( 91 void ConstrainedWindowTabHelper::DidNavigateMainFrame(
92 const content::LoadCommittedDetails& details, 92 const content::LoadCommittedDetails& details,
93 const content::FrameNavigateParams& params) { 93 const content::FrameNavigateParams& params) {
94 // Close constrained windows if necessary. 94 // Close constrained windows if necessary.
95 if (!net::RegistryControlledDomainService::SameDomainOrHost( 95 if (!net::RegistryControlledDomainService::SameDomainOrHost(
96 details.previous_url, details.entry->GetURL())) 96 details.previous_url, details.entry->GetURL()))
97 CloseConstrainedWindows(); 97 CloseConstrainedWindows();
98 } 98 }
99 99
100 void ConstrainedWindowTabHelper::DidGetIgnoredUIEvent() { 100 void ConstrainedWindowTabHelper::DidGetIgnoredUIEvent() {
101 if (constrained_window_count()) { 101 if (constrained_window_count()) {
102 ConstrainedWindow* window = *constrained_window_begin(); 102 ConstrainedWindow* window = *constrained_window_begin();
103 window->FocusConstrainedWindow(); 103 window->FocusConstrainedWindow();
104 } 104 }
105 } 105 }
106 106
107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) { 107 void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) {
108 // First cleanly close all child windows. 108 // First cleanly close all child windows.
109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked 109 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked
110 // some of these to close. CloseWindows is async, so it might get called 110 // some of these to close. CloseWindows is async, so it might get called
111 // twice before it runs. 111 // twice before it runs.
112 CloseConstrainedWindows(); 112 CloseConstrainedWindows();
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/constrained_window_tab_helper.h ('k') | chrome/browser/ui/constrained_window_tab_helper_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698