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

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

Issue 10082037: Revert 132284 - Fix build bustage by correcting ifdef (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « no previous file | 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_context.h" 7 #include "content/public/browser/browser_context.h"
8 #include "content/public/browser/notification_details.h" 8 #include "content/public/browser/notification_details.h"
9 #include "content/public/browser/notification_registrar.h" 9 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 AttachWebContents(); 55 AttachWebContents();
56 } 56 }
57 57
58 void WebView::SetFastResize(bool fast_resize) { 58 void WebView::SetFastResize(bool fast_resize) {
59 wcv_holder_->set_fast_resize(fast_resize); 59 wcv_holder_->set_fast_resize(fast_resize);
60 } 60 }
61 61
62 void WebView::OnWebContentsFocused(content::WebContents* web_contents) { 62 void WebView::OnWebContentsFocused(content::WebContents* web_contents) {
63 DCHECK(web_contents == web_contents_); 63 DCHECK(web_contents == web_contents_);
64 FocusManager* focus_manager = GetFocusManager(); 64 FocusManager* focus_manager = GetFocusManager();
65 if (focus_manager) 65 if (!focus_manager) {
66 focus_manager->SetFocusedView(this); 66 NOTREACHED();
67 return;
68 }
69 focus_manager->SetFocusedView(this);
67 } 70 }
68 71
69 //////////////////////////////////////////////////////////////////////////////// 72 ////////////////////////////////////////////////////////////////////////////////
70 // WebView, View overrides: 73 // WebView, View overrides:
71 74
72 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 75 void WebView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
73 wcv_holder_->SetSize(bounds().size()); 76 wcv_holder_->SetSize(bounds().size());
74 } 77 }
75 78
76 void WebView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { 79 void WebView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 registrar_.Add( 172 registrar_.Add(
170 this, 173 this,
171 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 174 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
172 content::Source<content::WebContents>(web_contents_)); 175 content::Source<content::WebContents>(web_contents_));
173 } 176 }
174 } 177 }
175 178
176 void WebView::DetachWebContents() { 179 void WebView::DetachWebContents() {
177 if (web_contents_) { 180 if (web_contents_) {
178 wcv_holder_->Detach(); 181 wcv_holder_->Detach();
179 #if defined(OS_WIN) && !defined(USE_AURA) 182 #if defined(OS_WIN)
180 // TODO(beng): This should either not be necessary, or be done implicitly by 183 // TODO(beng): This should either not be necessary, or be done implicitly by
181 // NativeViewHostWin on Detach(). As it stands, this is needed 184 // NativeViewHostWin on Detach(). As it stands, this is needed
182 // so that the view of the detached contents knows to tell the 185 // so that the view of the detached contents knows to tell the
183 // renderer its been hidden. 186 // renderer its been hidden.
184 ShowWindow(web_contents_->GetNativeView(), SW_HIDE); 187 ShowWindow(web_contents_->GetNativeView(), SW_HIDE);
185 #endif 188 #endif
186 } 189 }
187 registrar_.RemoveAll(); 190 registrar_.RemoveAll();
188 } 191 }
189 192
190 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, 193 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host,
191 content::RenderViewHost* new_host) { 194 content::RenderViewHost* new_host) {
192 if (GetFocusManager()->GetFocusedView() == this) 195 if (GetFocusManager()->GetFocusedView() == this)
193 web_contents_->Focus(); 196 web_contents_->Focus();
194 } 197 }
195 198
196 void WebView::WebContentsDestroyed(content::WebContents* web_contents) { 199 void WebView::WebContentsDestroyed(content::WebContents* web_contents) {
197 DCHECK(web_contents == web_contents_); 200 DCHECK(web_contents == web_contents_);
198 SetWebContents(NULL); 201 SetWebContents(NULL);
199 } 202 }
200 203
201 } // namespace views 204 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698