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

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

Issue 398603002: athena: Handle WebContents created for new windows and create activities for these. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only set delegate if actual web contents was passed to SwapWebContents. Created 6 years, 5 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
« no previous file with comments | « ui/views/controls/webview/webview.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_accessibility_state.h" 7 #include "content/public/browser/browser_accessibility_state.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 content::RenderWidgetHostView* host_view = 115 content::RenderWidgetHostView* host_view =
116 is_embedding_fullscreen_widget_ ? 116 is_embedding_fullscreen_widget_ ?
117 web_contents()->GetFullscreenRenderWidgetHostView() : 117 web_contents()->GetFullscreenRenderWidgetHostView() :
118 web_contents()->GetRenderWidgetHostView(); 118 web_contents()->GetRenderWidgetHostView();
119 if (host_view) 119 if (host_view)
120 return host_view->GetTextInputClient(); 120 return host_view->GetTextInputClient();
121 } 121 }
122 return NULL; 122 return NULL;
123 } 123 }
124 124
125 scoped_ptr<content::WebContents> WebView::SwapWebContents(
126 scoped_ptr<content::WebContents> new_web_contents) {
127 if (wc_owner_)
128 wc_owner_->SetDelegate(NULL);
129 scoped_ptr<content::WebContents> old_web_contents(wc_owner_.Pass());
130 wc_owner_ = new_web_contents.Pass();
131 if (wc_owner_)
132 wc_owner_->SetDelegate(this);
133 SetWebContents(wc_owner_.get());
134 return old_web_contents.Pass();
135 }
136
125 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 137 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
126 // In most cases, the holder is simply sized to fill this WebView's bounds. 138 // In most cases, the holder is simply sized to fill this WebView's bounds.
127 // Only WebContentses that are in fullscreen mode and being screen-captured 139 // Only WebContentses that are in fullscreen mode and being screen-captured
128 // will engage the special layout/sizing behavior. 140 // will engage the special layout/sizing behavior.
129 gfx::Rect holder_bounds(bounds().size()); 141 gfx::Rect holder_bounds(bounds().size());
130 if (!embed_fullscreen_widget_mode_enabled_ || 142 if (!embed_fullscreen_widget_mode_enabled_ ||
131 !web_contents() || 143 !web_contents() ||
132 web_contents()->GetCapturerCount() == 0 || 144 web_contents()->GetCapturerCount() == 0 ||
133 web_contents()->GetPreferredSize().IsEmpty() || 145 web_contents()->GetPreferredSize().IsEmpty() ||
134 !(is_embedding_fullscreen_widget_ || 146 !(is_embedding_fullscreen_widget_ ||
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 if (!contents) { 370 if (!contents) {
359 content::WebContents::CreateParams create_params( 371 content::WebContents::CreateParams create_params(
360 browser_context, NULL); 372 browser_context, NULL);
361 return content::WebContents::Create(create_params); 373 return content::WebContents::Create(create_params);
362 } 374 }
363 375
364 return contents; 376 return contents;
365 } 377 }
366 378
367 } // namespace views 379 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/webview/webview.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698