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

Side by Side Diff: ui/views/controls/webview/webview.cc

Issue 23618036: Merge NOTIFICATION_RENDER_VIEW_HOST_CHANGED into NOTIFICATION_WEB_CONTENTS_SWAPPED. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: java? Created 7 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 "ui/views/controls/webview/webview.h" 5 #include "ui/views/controls/webview/webview.h"
6 6
7 #include "content/public/browser/browser_context.h" 7 #include "content/public/browser/browser_context.h"
8 #include "content/public/browser/navigation_controller.h" 8 #include "content/public/browser/navigation_controller.h"
9 #include "content/public/browser/notification_details.h" 9 #include "content/public/browser/notification_details.h"
10 #include "content/public/browser/notification_registrar.h" 10 #include "content/public/browser/notification_registrar.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 else 154 else
155 return preferred_size_; 155 return preferred_size_;
156 } 156 }
157 157
158 //////////////////////////////////////////////////////////////////////////////// 158 ////////////////////////////////////////////////////////////////////////////////
159 // WebView, content::NotificationObserver implementation: 159 // WebView, content::NotificationObserver implementation:
160 160
161 void WebView::Observe(int type, 161 void WebView::Observe(int type,
162 const content::NotificationSource& source, 162 const content::NotificationSource& source,
163 const content::NotificationDetails& details) { 163 const content::NotificationDetails& details) {
164 if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) { 164 if (type == content::NOTIFICATION_WEB_CONTENTS_SWAPPED) {
165 std::pair<content::RenderViewHost*, content::RenderViewHost*>* 165 std::pair<content::RenderViewHost*, content::RenderViewHost*>*
166 switched_details = 166 switched_details =
167 content::Details<std::pair<content::RenderViewHost*, 167 content::Details<std::pair<content::RenderViewHost*,
168 content::RenderViewHost*> >( 168 content::RenderViewHost*> >(
169 details).ptr(); 169 details).ptr();
170 RenderViewHostChanged(switched_details->first, 170 RenderViewHostChanged(switched_details->first,
171 switched_details->second); 171 switched_details->second);
172 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 172 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
173 WebContentsDestroyed(content::Source<content::WebContents>(source).ptr()); 173 WebContentsDestroyed(content::Source<content::WebContents>(source).ptr());
174 } else { 174 } else {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 // The WebContentsView will not be focused automatically when it is 224 // The WebContentsView will not be focused automatically when it is
225 // attached, so we need to pass on focus to it if the FocusManager thinks 225 // attached, so we need to pass on focus to it if the FocusManager thinks
226 // the WebView is focused. Note that not every Widget has a focus manager. 226 // the WebView is focused. Note that not every Widget has a focus manager.
227 FocusManager* focus_manager = GetFocusManager(); 227 FocusManager* focus_manager = GetFocusManager();
228 if (focus_manager && focus_manager->GetFocusedView() == this) 228 if (focus_manager && focus_manager->GetFocusedView() == this)
229 web_contents_->GetView()->Focus(); 229 web_contents_->GetView()->Focus();
230 230
231 registrar_.Add( 231 registrar_.Add(
232 this, 232 this,
233 content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, 233 content::NOTIFICATION_WEB_CONTENTS_SWAPPED,
234 content::Source<content::NavigationController>( 234 content::Source<content::WebContents>(web_contents_));
235 &web_contents_->GetController()));
236 registrar_.Add( 235 registrar_.Add(
237 this, 236 this,
238 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 237 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
239 content::Source<content::WebContents>(web_contents_)); 238 content::Source<content::WebContents>(web_contents_));
240 } 239 }
241 240
242 #if defined(OS_WIN) && defined(USE_AURA) 241 #if defined(OS_WIN) && defined(USE_AURA)
243 web_contents_->SetParentNativeViewAccessible( 242 web_contents_->SetParentNativeViewAccessible(
244 parent()->GetNativeViewAccessible()); 243 parent()->GetNativeViewAccessible());
245 #endif 244 #endif
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 if (!contents) { 286 if (!contents) {
288 content::WebContents::CreateParams create_params( 287 content::WebContents::CreateParams create_params(
289 browser_context, site_instance); 288 browser_context, site_instance);
290 return content::WebContents::Create(create_params); 289 return content::WebContents::Create(create_params);
291 } 290 }
292 291
293 return contents; 292 return contents;
294 } 293 }
295 294
296 } // namespace views 295 } // namespace views
OLDNEW
« content/public/browser/notification_types.h ('K') | « content/public/browser/web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698