OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
11 #include "base/scoped_cftyperef.h" | 11 #include "base/scoped_cftyperef.h" |
12 #include "chrome/browser/tab_contents/web_contents_view.h" | 12 #include "chrome/browser/tab_contents/web_contents_view.h" |
| 13 #include "chrome/common/notification_registrar.h" |
13 | 14 |
14 class FindBarMac; | 15 class FindBarMac; |
| 16 @class SadTabView; |
15 | 17 |
16 @interface WebContentsViewCocoa : NSView { | 18 @interface WebContentsViewCocoa : NSView { |
17 } | 19 } |
18 | 20 |
19 @end | 21 @end |
20 | 22 |
21 // Mac-specific implementation of the WebContentsView. It owns an NSView that | 23 // Mac-specific implementation of the WebContentsView. It owns an NSView that |
22 // contains all of the contents of the tab and associated child views. | 24 // contains all of the contents of the tab and associated child views. |
23 class WebContentsViewMac : public WebContentsView { | 25 class WebContentsViewMac : public WebContentsView, |
| 26 public NotificationObserver { |
24 public: | 27 public: |
25 // The corresponding WebContents is passed in the constructor, and manages our | 28 // The corresponding WebContents is passed in the constructor, and manages our |
26 // lifetime. This doesn't need to be the case, but is this way currently | 29 // lifetime. This doesn't need to be the case, but is this way currently |
27 // because that's what was easiest when they were split. | 30 // because that's what was easiest when they were split. |
28 explicit WebContentsViewMac(WebContents* web_contents); | 31 explicit WebContentsViewMac(WebContents* web_contents); |
29 virtual ~WebContentsViewMac(); | 32 virtual ~WebContentsViewMac(); |
30 | 33 |
31 // WebContentsView implementation -------------------------------------------- | 34 // WebContentsView implementation -------------------------------------------- |
32 | 35 |
33 virtual WebContents* GetWebContents(); | 36 virtual WebContents* GetWebContents(); |
(...skipping 29 matching lines...) Expand all Loading... |
63 virtual void StartDragging(const WebDropData& drop_data); | 66 virtual void StartDragging(const WebDropData& drop_data); |
64 virtual void UpdateDragCursor(bool is_drop_target); | 67 virtual void UpdateDragCursor(bool is_drop_target); |
65 virtual void TakeFocus(bool reverse); | 68 virtual void TakeFocus(bool reverse); |
66 virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); | 69 virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); |
67 virtual void OnFindReply(int request_id, | 70 virtual void OnFindReply(int request_id, |
68 int number_of_matches, | 71 int number_of_matches, |
69 const gfx::Rect& selection_rect, | 72 const gfx::Rect& selection_rect, |
70 int active_match_ordinal, | 73 int active_match_ordinal, |
71 bool final_update); | 74 bool final_update); |
72 | 75 |
| 76 // NotificationObserver implementation --------------------------------------- |
| 77 |
| 78 virtual void Observe(NotificationType type, |
| 79 const NotificationSource& source, |
| 80 const NotificationDetails& details); |
| 81 |
73 private: | 82 private: |
74 // --------------------------------------------------------------------------- | 83 // --------------------------------------------------------------------------- |
75 | 84 |
76 WebContents* web_contents_; | 85 WebContents* web_contents_; |
77 | 86 |
78 // The Cocoa NSView that lives in the view hierarchy. | 87 // The Cocoa NSView that lives in the view hierarchy. |
79 scoped_cftyperef<WebContentsViewCocoa*> cocoa_view_; | 88 scoped_cftyperef<WebContentsViewCocoa*> cocoa_view_; |
80 | 89 |
81 // For find in page. This may be NULL if there is no find bar, and if it is | 90 // For find in page. This may be NULL if there is no find bar, and if it is |
82 // non-NULL, it may or may not be visible. | 91 // non-NULL, it may or may not be visible. |
83 scoped_ptr<FindBarMac> find_bar_; | 92 scoped_ptr<FindBarMac> find_bar_; |
84 | 93 |
| 94 // Used to get notifications about renderers coming and going. |
| 95 NotificationRegistrar registrar_; |
| 96 |
| 97 // Used to render the sad tab. This will be non-NULL only when the sad tab is |
| 98 // visible. |
| 99 scoped_cftyperef<SadTabView*> sad_tab_; |
| 100 |
85 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); | 101 DISALLOW_COPY_AND_ASSIGN(WebContentsViewMac); |
86 }; | 102 }; |
87 | 103 |
88 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ | 104 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_VIEW_MAC_H_ |
OLD | NEW |