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

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

Issue 11231077: Move a bunch more code into the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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"
11 #include "content/browser/renderer_host/render_widget_host_view_win.h" 11 #include "content/browser/renderer_host/render_widget_host_view_win.h"
12 #include "content/browser/web_contents/interstitial_page_impl.h" 12 #include "content/browser/web_contents/interstitial_page_impl.h"
13 #include "content/browser/web_contents/web_contents_drag_win.h" 13 #include "content/browser/web_contents/web_contents_drag_win.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 14 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/browser/web_contents/web_drag_dest_win.h" 15 #include "content/browser/web_contents/web_drag_dest_win.h"
16 #include "content/public/browser/web_contents_delegate.h" 16 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/browser/web_contents_view_delegate.h" 17 #include "content/public/browser/web_contents_view_delegate.h"
18 #include "ui/base/win/hidden_window.h" 18 #include "ui/base/win/hidden_window.h"
19 #include "ui/base/win/hwnd_subclass.h" 19 #include "ui/base/win/hwnd_subclass.h"
20 #include "ui/gfx/screen.h" 20 #include "ui/gfx/screen.h"
21 21
22 using content::RenderViewHost;
23 using content::RenderWidgetHostView;
24 using content::RenderWidgetHostViewWin;
25 using content::WebContents;
26 using content::WebContentsViewDelegate;
27
28 namespace content { 22 namespace content {
29 WebContentsView* CreateWebContentsView( 23 WebContentsView* CreateWebContentsView(
30 WebContentsImpl* web_contents, 24 WebContentsImpl* web_contents,
31 WebContentsViewDelegate* delegate, 25 WebContentsViewDelegate* delegate,
32 RenderViewHostDelegateView** render_view_host_delegate_view) { 26 RenderViewHostDelegateView** render_view_host_delegate_view) {
33 WebContentsViewWin* rv = new WebContentsViewWin(web_contents, delegate); 27 WebContentsViewWin* rv = new WebContentsViewWin(web_contents, delegate);
34 *render_view_host_delegate_view = rv; 28 *render_view_host_delegate_view = rv;
35 return rv; 29 return rv;
36 } 30 }
37 }
38 31
39 namespace { 32 namespace {
40 33
41 typedef std::map<HWND, WebContentsViewWin*> HwndToWcvMap; 34 typedef std::map<HWND, WebContentsViewWin*> HwndToWcvMap;
42 HwndToWcvMap hwnd_to_wcv_map; 35 HwndToWcvMap hwnd_to_wcv_map;
43 36
44 void RemoveHwndToWcvMapEntry(WebContentsViewWin* wcv) { 37 void RemoveHwndToWcvMapEntry(WebContentsViewWin* wcv) {
45 HwndToWcvMap::iterator it; 38 HwndToWcvMap::iterator it;
46 for (it = hwnd_to_wcv_map.begin(); it != hwnd_to_wcv_map.end();) { 39 for (it = hwnd_to_wcv_map.begin(); it != hwnd_to_wcv_map.end();) {
47 if (it->second == wcv) 40 if (it->second == wcv)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 initial_size_ = initial_size; 106 initial_size_ = initial_size;
114 107
115 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); 108 set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
116 109
117 Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_)); 110 Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_));
118 111
119 // Remove the root view drop target so we can register our own. 112 // Remove the root view drop target so we can register our own.
120 RevokeDragDrop(GetNativeView()); 113 RevokeDragDrop(GetNativeView());
121 drag_dest_ = new WebDragDest(hwnd(), web_contents_); 114 drag_dest_ = new WebDragDest(hwnd(), web_contents_);
122 if (delegate_.get()) { 115 if (delegate_.get()) {
123 content::WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate(); 116 WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate();
124 if (delegate) 117 if (delegate)
125 drag_dest_->set_delegate(delegate); 118 drag_dest_->set_delegate(delegate);
126 } 119 }
127 } 120 }
128 121
129 RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget( 122 RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget(
130 content::RenderWidgetHost* render_widget_host) { 123 RenderWidgetHost* render_widget_host) {
131 if (render_widget_host->GetView()) { 124 if (render_widget_host->GetView()) {
132 // During testing, the view will already be set up in most cases to the 125 // During testing, the view will already be set up in most cases to the
133 // test view, so we don't want to clobber it with a real one. To verify that 126 // test view, so we don't want to clobber it with a real one. To verify that
134 // this actually is happening (and somebody isn't accidentally creating the 127 // this actually is happening (and somebody isn't accidentally creating the
135 // view twice), we check for the RVH Factory, which will be set when we're 128 // view twice), we check for the RVH Factory, which will be set when we're
136 // making special ones (which go along with the special views). 129 // making special ones (which go along with the special views).
137 DCHECK(RenderViewHostFactory::has_factory()); 130 DCHECK(RenderViewHostFactory::has_factory());
138 return render_widget_host->GetView(); 131 return render_widget_host->GetView();
139 } 132 }
140 133
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void WebContentsViewWin::CloseTabAfterEventTracking() { 236 void WebContentsViewWin::CloseTabAfterEventTracking() {
244 } 237 }
245 238
246 gfx::Rect WebContentsViewWin::GetViewBounds() const { 239 gfx::Rect WebContentsViewWin::GetViewBounds() const {
247 RECT r; 240 RECT r;
248 GetWindowRect(hwnd(), &r); 241 GetWindowRect(hwnd(), &r);
249 return gfx::Rect(r); 242 return gfx::Rect(r);
250 } 243 }
251 244
252 void WebContentsViewWin::ShowContextMenu( 245 void WebContentsViewWin::ShowContextMenu(
253 const content::ContextMenuParams& params, 246 const ContextMenuParams& params,
254 content::ContextMenuSourceType type) { 247 ContextMenuSourceType type) {
255 if (delegate_.get()) 248 if (delegate_.get())
256 delegate_->ShowContextMenu(params, type); 249 delegate_->ShowContextMenu(params, type);
257 } 250 }
258 251
259 void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds, 252 void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds,
260 int item_height, 253 int item_height,
261 double item_font_size, 254 double item_font_size,
262 int selected_item, 255 int selected_item,
263 const std::vector<WebMenuItem>& items, 256 const std::vector<WebMenuItem>& items,
264 bool right_aligned, 257 bool right_aligned,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 si.nMin = 1; 469 si.nMin = 1;
477 si.nMax = 100; 470 si.nMax = 100;
478 si.nPage = 10; 471 si.nPage = 10;
479 si.nPos = 50; 472 si.nPos = 50;
480 473
481 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE); 474 ::SetScrollInfo(hwnd(), SB_HORZ, &si, FALSE);
482 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE); 475 ::SetScrollInfo(hwnd(), SB_VERT, &si, FALSE);
483 476
484 return 1; 477 return 1;
485 } 478 }
479
480 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_win.h ('k') | content/browser/web_contents/web_drag_dest_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698