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

Side by Side Diff: content/browser/web_contents/web_contents_view_win.cc

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 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
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 "content/browser/web_contents/web_contents_view_win.h" 5 #include "content/browser/web_contents/web_contents_view_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "content/browser/renderer_host/render_view_host_factory.h" 9 #include "content/browser/renderer_host/render_view_host_factory.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const gfx::Size& initial_size, gfx::NativeView context) { 148 const gfx::Size& initial_size, gfx::NativeView context) {
149 initial_size_ = initial_size; 149 initial_size_ = initial_size;
150 150
151 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); 151 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
152 152
153 Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_)); 153 Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_));
154 154
155 // Remove the root view drop target so we can register our own. 155 // Remove the root view drop target so we can register our own.
156 RevokeDragDrop(GetNativeView()); 156 RevokeDragDrop(GetNativeView());
157 drag_dest_ = new WebDragDest(hwnd(), web_contents_); 157 drag_dest_ = new WebDragDest(hwnd(), web_contents_);
158 if (delegate_.get()) { 158 if (delegate_) {
159 WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate(); 159 WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate();
160 if (delegate) 160 if (delegate)
161 drag_dest_->set_delegate(delegate); 161 drag_dest_->set_delegate(delegate);
162 } 162 }
163 } 163 }
164 164
165 void WebContentsViewWin::Focus() { 165 void WebContentsViewWin::Focus() {
166 if (web_contents_->GetInterstitialPage()) { 166 if (web_contents_->GetInterstitialPage()) {
167 web_contents_->GetInterstitialPage()->Focus(); 167 web_contents_->GetInterstitialPage()->Focus();
168 return; 168 return;
169 } 169 }
170 170
171 if (delegate_.get() && delegate_->Focus()) 171 if (delegate_.get() && delegate_->Focus())
172 return; 172 return;
173 173
174 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 174 RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
175 if (rwhv) 175 if (rwhv)
176 rwhv->Focus(); 176 rwhv->Focus();
177 } 177 }
178 178
179 void WebContentsViewWin::SetInitialFocus() { 179 void WebContentsViewWin::SetInitialFocus() {
180 if (web_contents_->FocusLocationBarByDefault()) 180 if (web_contents_->FocusLocationBarByDefault())
181 web_contents_->SetFocusToLocationBar(false); 181 web_contents_->SetFocusToLocationBar(false);
182 else 182 else
183 Focus(); 183 Focus();
184 } 184 }
185 185
186 void WebContentsViewWin::StoreFocus() { 186 void WebContentsViewWin::StoreFocus() {
187 if (delegate_.get()) 187 if (delegate_)
188 delegate_->StoreFocus(); 188 delegate_->StoreFocus();
189 } 189 }
190 190
191 void WebContentsViewWin::RestoreFocus() { 191 void WebContentsViewWin::RestoreFocus() {
192 if (delegate_.get()) 192 if (delegate_)
193 delegate_->RestoreFocus(); 193 delegate_->RestoreFocus();
194 } 194 }
195 195
196 WebDropData* WebContentsViewWin::GetDropData() const { 196 WebDropData* WebContentsViewWin::GetDropData() const {
197 return drag_dest_->current_drop_data(); 197 return drag_dest_->current_drop_data();
198 } 198 }
199 199
200 gfx::Rect WebContentsViewWin::GetViewBounds() const { 200 gfx::Rect WebContentsViewWin::GetViewBounds() const {
201 RECT r; 201 RECT r;
202 GetWindowRect(hwnd(), &r); 202 GetWindowRect(hwnd(), &r);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 void WebContentsViewWin::RenderViewSwappedIn(RenderViewHost* host) { 240 void WebContentsViewWin::RenderViewSwappedIn(RenderViewHost* host) {
241 } 241 }
242 242
243 void WebContentsViewWin::SetOverscrollControllerEnabled(bool enabled) { 243 void WebContentsViewWin::SetOverscrollControllerEnabled(bool enabled) {
244 } 244 }
245 245
246 void WebContentsViewWin::ShowContextMenu( 246 void WebContentsViewWin::ShowContextMenu(
247 const ContextMenuParams& params, 247 const ContextMenuParams& params,
248 ContextMenuSourceType type) { 248 ContextMenuSourceType type) {
249 if (delegate_.get()) 249 if (delegate_)
250 delegate_->ShowContextMenu(params, type); 250 delegate_->ShowContextMenu(params, type);
251 } 251 }
252 252
253 void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds, 253 void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds,
254 int item_height, 254 int item_height,
255 double item_font_size, 255 double item_font_size,
256 int selected_item, 256 int selected_item,
257 const std::vector<WebMenuItem>& items, 257 const std::vector<WebMenuItem>& items,
258 bool right_aligned, 258 bool right_aligned,
259 bool allow_multiple_selection) { 259 bool allow_multiple_selection) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 LRESULT WebContentsViewWin::OnCreate( 304 LRESULT WebContentsViewWin::OnCreate(
305 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { 305 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) {
306 hwnd_to_wcv_map.insert(std::make_pair(hwnd(), this)); 306 hwnd_to_wcv_map.insert(std::make_pair(hwnd(), this));
307 AddFilterToParentHwndSubclass(hwnd(), hwnd_message_filter_.get()); 307 AddFilterToParentHwndSubclass(hwnd(), hwnd_message_filter_.get());
308 return 0; 308 return 0;
309 } 309 }
310 310
311 LRESULT WebContentsViewWin::OnDestroy( 311 LRESULT WebContentsViewWin::OnDestroy(
312 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { 312 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) {
313 if (drag_dest_.get()) { 313 if (drag_dest_) {
314 RevokeDragDrop(GetNativeView()); 314 RevokeDragDrop(GetNativeView());
315 drag_dest_ = NULL; 315 drag_dest_ = NULL;
316 } 316 }
317 if (drag_handler_.get()) { 317 if (drag_handler_) {
318 drag_handler_->CancelDrag(); 318 drag_handler_->CancelDrag();
319 drag_handler_ = NULL; 319 drag_handler_ = NULL;
320 } 320 }
321 return 0; 321 return 0;
322 } 322 }
323 323
324 LRESULT WebContentsViewWin::OnWindowPosChanged( 324 LRESULT WebContentsViewWin::OnWindowPosChanged(
325 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { 325 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) {
326 326
327 // Our parent might have changed. So we re-install our hwnd message filter. 327 // Our parent might have changed. So we re-install our hwnd message filter.
(...skipping 22 matching lines...) Expand all
350 // size hasn't changed. 350 // size hasn't changed.
351 if (window_pos->flags & SWP_NOSIZE) 351 if (window_pos->flags & SWP_NOSIZE)
352 return 0; 352 return 0;
353 353
354 gfx::Size size(window_pos->cx, window_pos->cy); 354 gfx::Size size(window_pos->cx, window_pos->cy);
355 if (web_contents_->GetInterstitialPage()) 355 if (web_contents_->GetInterstitialPage())
356 web_contents_->GetInterstitialPage()->SetSize(size); 356 web_contents_->GetInterstitialPage()->SetSize(size);
357 if (rwhv) 357 if (rwhv)
358 rwhv->SetSize(size); 358 rwhv->SetSize(size);
359 359
360 if (delegate_.get()) 360 if (delegate_)
361 delegate_->SizeChanged(size); 361 delegate_->SizeChanged(size);
362 362
363 return 0; 363 return 0;
364 } 364 }
365 365
366 LRESULT WebContentsViewWin::OnMouseDown( 366 LRESULT WebContentsViewWin::OnMouseDown(
367 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { 367 UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) {
368 // Make sure this WebContents is activated when it is clicked on. 368 // Make sure this WebContents is activated when it is clicked on.
369 if (web_contents_->GetDelegate()) 369 if (web_contents_->GetDelegate())
370 web_contents_->GetDelegate()->ActivateContents(web_contents_); 370 web_contents_->GetDelegate()->ActivateContents(web_contents_);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 si.nPage = 10; 457 si.nPage = 10;
458 si.nPos = 50; 458 si.nPos = 50;
459 459
460 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE); 460 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE);
461 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE); 461 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE);
462 462
463 return 1; 463 return 1;
464 } 464 }
465 465
466 } // namespace content 466 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.mm ('k') | content/browser/web_contents/web_drag_source_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698