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

Side by Side Diff: content/browser/web_contents/web_contents_view_mac.h

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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_nsobject.h" 13 #include "base/memory/scoped_nsobject.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/port/browser/render_view_host_delegate_view.h" 15 #include "content/port/browser/render_view_host_delegate_view.h"
16 #include "content/public/browser/web_contents_view.h" 16 #include "content/public/browser/web_contents_view.h"
17 #include "ui/base/cocoa/base_view.h" 17 #include "ui/base/cocoa/base_view.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 @class FocusTracker; 20 @class FocusTracker;
21 class SkBitmap; 21 class SkBitmap;
22 class WebContentsImpl;
23 class WebContentsViewMac; 22 class WebContentsViewMac;
24 @class WebDragDest; 23 @class WebDragDest;
25 @class WebDragSource; 24 @class WebDragSource;
26 25
27 namespace content { 26 namespace content {
27 class WebContentsImpl;
28 class WebContentsViewDelegate; 28 class WebContentsViewDelegate;
29 } 29 }
30 30
31 namespace gfx { 31 namespace gfx {
32 class Point; 32 class Point;
33 } 33 }
34 34
35 @interface WebContentsViewCocoa : BaseView { 35 @interface WebContentsViewCocoa : BaseView {
36 @private 36 @private
37 WebContentsViewMac* webContentsView_; // WEAK; owns us 37 WebContentsViewMac* webContentsView_; // WEAK; owns us
38 scoped_nsobject<WebDragSource> dragSource_; 38 scoped_nsobject<WebDragSource> dragSource_;
39 scoped_nsobject<WebDragDest> dragDest_; 39 scoped_nsobject<WebDragDest> dragDest_;
40 BOOL mouseDownCanMoveWindow_; 40 BOOL mouseDownCanMoveWindow_;
41 } 41 }
42 42
43 - (void)setMouseDownCanMoveWindow:(BOOL)canMove; 43 - (void)setMouseDownCanMoveWindow:(BOOL)canMove;
44 44
45 // Expose this, since sometimes one needs both the NSView and the 45 // Expose this, since sometimes one needs both the NSView and the
46 // WebContentsImpl. 46 // WebContentsImpl.
47 - (WebContentsImpl*)webContents; 47 - (content::WebContentsImpl*)webContents;
48 @end 48 @end
49 49
50 // Mac-specific implementation of the WebContentsView. It owns an NSView that 50 // Mac-specific implementation of the WebContentsView. It owns an NSView that
51 // contains all of the contents of the tab and associated child views. 51 // contains all of the contents of the tab and associated child views.
52 class WebContentsViewMac 52 class WebContentsViewMac
53 : public content::WebContentsView, 53 : public content::WebContentsView,
54 public content::RenderViewHostDelegateView { 54 public content::RenderViewHostDelegateView {
55 public: 55 public:
56 // The corresponding WebContentsImpl is passed in the constructor, and manages 56 // The corresponding WebContentsImpl is passed in the constructor, and manages
57 // our lifetime. This doesn't need to be the case, but is this way currently 57 // our lifetime. This doesn't need to be the case, but is this way currently
58 // because that's what was easiest when they were split. 58 // because that's what was easiest when they were split.
59 WebContentsViewMac(WebContentsImpl* web_contents, 59 WebContentsViewMac(content::WebContentsImpl* web_contents,
60 content::WebContentsViewDelegate* delegate); 60 content::WebContentsViewDelegate* delegate);
61 virtual ~WebContentsViewMac(); 61 virtual ~WebContentsViewMac();
62 62
63 // WebContentsView implementation -------------------------------------------- 63 // WebContentsView implementation --------------------------------------------
64 64
65 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; 65 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE;
66 virtual content::RenderWidgetHostView* CreateViewForWidget( 66 virtual content::RenderWidgetHostView* CreateViewForWidget(
67 content::RenderWidgetHost* render_widget_host) OVERRIDE; 67 content::RenderWidgetHost* render_widget_host) OVERRIDE;
68 virtual gfx::NativeView GetNativeView() const OVERRIDE; 68 virtual gfx::NativeView GetNativeView() const OVERRIDE;
69 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; 69 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
(...skipping 29 matching lines...) Expand all
99 const gfx::ImageSkia& image, 99 const gfx::ImageSkia& image,
100 const gfx::Point& image_offset) OVERRIDE; 100 const gfx::Point& image_offset) OVERRIDE;
101 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE; 101 virtual void UpdateDragCursor(WebKit::WebDragOperation operation) OVERRIDE;
102 virtual void GotFocus() OVERRIDE; 102 virtual void GotFocus() OVERRIDE;
103 virtual void TakeFocus(bool reverse) OVERRIDE; 103 virtual void TakeFocus(bool reverse) OVERRIDE;
104 104
105 // A helper method for closing the tab in the 105 // A helper method for closing the tab in the
106 // CloseTabAfterEventTracking() implementation. 106 // CloseTabAfterEventTracking() implementation.
107 void CloseTab(); 107 void CloseTab();
108 108
109 WebContentsImpl* web_contents() { return web_contents_; } 109 content::WebContentsImpl* web_contents() { return web_contents_; }
110 content::WebContentsViewDelegate* delegate() { return delegate_.get(); } 110 content::WebContentsViewDelegate* delegate() { return delegate_.get(); }
111 111
112 private: 112 private:
113 // The WebContentsImpl whose contents we display. 113 // The WebContentsImpl whose contents we display.
114 WebContentsImpl* web_contents_; 114 content::WebContentsImpl* web_contents_;
115 115
116 // The Cocoa NSView that lives in the view hierarchy. 116 // The Cocoa NSView that lives in the view hierarchy.
117 scoped_nsobject<WebContentsViewCocoa> cocoa_view_; 117 scoped_nsobject<WebContentsViewCocoa> cocoa_view_;
118 118
119 // Keeps track of which NSView has focus so we can restore the focus when 119 // Keeps track of which NSView has focus so we can restore the focus when
120 // focus returns. 120 // focus returns.
121 scoped_nsobject<FocusTracker> focus_tracker_; 121 scoped_nsobject<FocusTracker> focus_tracker_;
122 122
123 // Our optional delegate. 123 // Our optional delegate.
124 scoped_ptr<content::WebContentsViewDelegate> delegate_; 124 scoped_ptr<content::WebContentsViewDelegate> delegate_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); 126 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac);
127 }; 127 };
128 128
129 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ 129 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_gtk.cc ('k') | content/browser/web_contents/web_contents_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698