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

Side by Side Diff: chrome/browser/ui/panels/panel_host.cc

Issue 10868116: Pass result of blockage across content API when new tab blocked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/panels/panel_host.h" 5 #include "chrome/browser/ui/panels/panel_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/chrome_page_zoom.h" 10 #include "chrome/browser/chrome_page_zoom.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void PanelHost::NavigationStateChanged(const content::WebContents* source, 102 void PanelHost::NavigationStateChanged(const content::WebContents* source,
103 unsigned changed_flags) { 103 unsigned changed_flags) {
104 // Only need to update the title if the title changed while not loading, 104 // Only need to update the title if the title changed while not loading,
105 // because the title is also updated when loading state changes. 105 // because the title is also updated when loading state changes.
106 if ((changed_flags & content::INVALIDATE_TYPE_TAB) || 106 if ((changed_flags & content::INVALIDATE_TYPE_TAB) ||
107 ((changed_flags & content::INVALIDATE_TYPE_TITLE) && 107 ((changed_flags & content::INVALIDATE_TYPE_TITLE) &&
108 !source->IsLoading())) 108 !source->IsLoading()))
109 panel_->UpdateTitleBar(); 109 panel_->UpdateTitleBar();
110 } 110 }
111 111
112 void PanelHost::AddNewContents(content::WebContents* source, 112 bool PanelHost::AddNewContents(content::WebContents* source,
113 content::WebContents* new_contents, 113 content::WebContents* new_contents,
114 WindowOpenDisposition disposition, 114 WindowOpenDisposition disposition,
115 const gfx::Rect& initial_pos, 115 const gfx::Rect& initial_pos,
116 bool user_gesture) { 116 bool user_gesture) {
117 chrome::NavigateParams navigate_params(profile_, new_contents->GetURL(), 117 chrome::NavigateParams navigate_params(profile_, new_contents->GetURL(),
118 content::PAGE_TRANSITION_LINK); 118 content::PAGE_TRANSITION_LINK);
119 // Create a TabContents because the NavigateParams takes a TabContents, 119 // Create a TabContents because the NavigateParams takes a TabContents,
120 // not a WebContents, for the target_contents. 120 // not a WebContents, for the target_contents.
121 TabContents* new_tab_contents = TabContents::FromWebContents(new_contents); 121 TabContents* new_tab_contents = TabContents::FromWebContents(new_contents);
122 if (!new_tab_contents) 122 if (!new_tab_contents)
123 new_tab_contents = TabContents::Factory::CreateTabContents(new_contents); 123 new_tab_contents = TabContents::Factory::CreateTabContents(new_contents);
124 navigate_params.target_contents = new_tab_contents; 124 navigate_params.target_contents = new_tab_contents;
125 125
126 // Force all links to open in a new tab, even if they were trying to open a 126 // Force all links to open in a new tab, even if they were trying to open a
127 // window. 127 // window.
128 navigate_params.disposition = 128 navigate_params.disposition =
129 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; 129 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB;
130 130
131 navigate_params.window_bounds = initial_pos; 131 navigate_params.window_bounds = initial_pos;
132 navigate_params.user_gesture = user_gesture; 132 navigate_params.user_gesture = user_gesture;
133 navigate_params.extension_app_id = panel_->extension_id(); 133 navigate_params.extension_app_id = panel_->extension_id();
134 chrome::Navigate(&navigate_params); 134 chrome::Navigate(&navigate_params);
135 return true;
135 } 136 }
136 137
137 void PanelHost::ActivateContents(content::WebContents* contents) { 138 void PanelHost::ActivateContents(content::WebContents* contents) {
138 panel_->Activate(); 139 panel_->Activate();
139 } 140 }
140 141
141 void PanelHost::DeactivateContents(content::WebContents* contents) { 142 void PanelHost::DeactivateContents(content::WebContents* contents) {
142 panel_->Deactivate(); 143 panel_->Deactivate();
143 } 144 }
144 145
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 247 }
247 248
248 void PanelHost::StopLoading() { 249 void PanelHost::StopLoading() {
249 content::RecordAction(UserMetricsAction("Stop")); 250 content::RecordAction(UserMetricsAction("Stop"));
250 web_contents_->Stop(); 251 web_contents_->Stop();
251 } 252 }
252 253
253 void PanelHost::Zoom(content::PageZoom zoom) { 254 void PanelHost::Zoom(content::PageZoom zoom) {
254 chrome_page_zoom::Zoom(web_contents_.get(), zoom); 255 chrome_page_zoom::Zoom(web_contents_.get(), zoom);
255 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698