OLD | NEW |
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 <utility> |
| 8 |
7 #include "content/public/browser/browser_accessibility_state.h" | 9 #include "content/public/browser/browser_accessibility_state.h" |
8 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/navigation_controller.h" | 11 #include "content/public/browser/navigation_controller.h" |
10 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
11 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
14 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
15 #include "ui/accessibility/ax_enums.h" | 17 #include "ui/accessibility/ax_enums.h" |
16 #include "ui/accessibility/ax_view_state.h" | 18 #include "ui/accessibility/ax_view_state.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // WebView, View overrides: | 108 // WebView, View overrides: |
107 | 109 |
108 const char* WebView::GetClassName() const { | 110 const char* WebView::GetClassName() const { |
109 return kViewClassName; | 111 return kViewClassName; |
110 } | 112 } |
111 | 113 |
112 scoped_ptr<content::WebContents> WebView::SwapWebContents( | 114 scoped_ptr<content::WebContents> WebView::SwapWebContents( |
113 scoped_ptr<content::WebContents> new_web_contents) { | 115 scoped_ptr<content::WebContents> new_web_contents) { |
114 if (wc_owner_) | 116 if (wc_owner_) |
115 wc_owner_->SetDelegate(NULL); | 117 wc_owner_->SetDelegate(NULL); |
116 scoped_ptr<content::WebContents> old_web_contents(wc_owner_.Pass()); | 118 scoped_ptr<content::WebContents> old_web_contents(std::move(wc_owner_)); |
117 wc_owner_ = new_web_contents.Pass(); | 119 wc_owner_ = std::move(new_web_contents); |
118 if (wc_owner_) | 120 if (wc_owner_) |
119 wc_owner_->SetDelegate(this); | 121 wc_owner_->SetDelegate(this); |
120 SetWebContents(wc_owner_.get()); | 122 SetWebContents(wc_owner_.get()); |
121 return old_web_contents.Pass(); | 123 return old_web_contents; |
122 } | 124 } |
123 | 125 |
124 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 126 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
125 // In most cases, the holder is simply sized to fill this WebView's bounds. | 127 // In most cases, the holder is simply sized to fill this WebView's bounds. |
126 // Only WebContentses that are in fullscreen mode and being screen-captured | 128 // Only WebContentses that are in fullscreen mode and being screen-captured |
127 // will engage the special layout/sizing behavior. | 129 // will engage the special layout/sizing behavior. |
128 gfx::Rect holder_bounds(bounds().size()); | 130 gfx::Rect holder_bounds(bounds().size()); |
129 if (!embed_fullscreen_widget_mode_enabled_ || | 131 if (!embed_fullscreen_widget_mode_enabled_ || |
130 !web_contents() || | 132 !web_contents() || |
131 web_contents()->GetCapturerCount() == 0 || | 133 web_contents()->GetCapturerCount() == 0 || |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (!contents) { | 392 if (!contents) { |
391 content::WebContents::CreateParams create_params( | 393 content::WebContents::CreateParams create_params( |
392 browser_context, NULL); | 394 browser_context, NULL); |
393 return content::WebContents::Create(create_params); | 395 return content::WebContents::Create(create_params); |
394 } | 396 } |
395 | 397 |
396 return contents; | 398 return contents; |
397 } | 399 } |
398 | 400 |
399 } // namespace views | 401 } // namespace views |
OLD | NEW |