OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROL
LER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROL
LER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROL
LER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROL
LER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #import "chrome/browser/ui/cocoa/omnibox_decoration_bubble_controller.h" | 14 #import "chrome/browser/ui/cocoa/omnibox_decoration_bubble_controller.h" |
15 #include "chrome/browser/ui/page_info/website_settings_ui.h" | 15 #include "chrome/browser/ui/page_info/page_info_ui.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
17 | 17 |
18 class WebsiteSettingsUIBridge; | 18 class PageInfoUIBridge; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 class X509Certificate; | 25 class X509Certificate; |
26 } | 26 } |
27 | 27 |
28 namespace security_state { | 28 namespace security_state { |
29 struct SecurityInfo; | 29 struct SecurityInfo; |
30 } // namespace security_state | 30 } // namespace security_state |
31 | 31 |
32 // This NSWindowController subclass manages the InfoBubbleWindow and view that | 32 // This NSWindowController subclass manages the InfoBubbleWindow and view that |
33 // are displayed when the user clicks the favicon or security lock icon. | 33 // are displayed when the user clicks the favicon or security lock icon. |
34 // | 34 // |
35 // TODO(palmer): Normalize all WebsiteSettings*, SiteSettings*, PageInfo*, et c. | 35 // TODO(palmer): Normalize all PageInfo*, SiteSettings*, PageInfo*, et c. |
36 // to OriginInfo*. | 36 // to OriginInfo*. |
37 @interface WebsiteSettingsBubbleController : OmniboxDecorationBubbleController { | 37 @interface PageInfoBubbleController : OmniboxDecorationBubbleController { |
38 @private | 38 @private |
39 content::WebContents* webContents_; | 39 content::WebContents* webContents_; |
40 | 40 |
41 base::scoped_nsobject<NSView> contentView_; | 41 base::scoped_nsobject<NSView> contentView_; |
42 | 42 |
43 // The main content view for the Permissions tab. | 43 // The main content view for the Permissions tab. |
44 NSView* securitySectionView_; | 44 NSView* securitySectionView_; |
45 | 45 |
46 // Displays the short security summary for the page | 46 // Displays the short security summary for the page |
47 // (private/not private/etc.). | 47 // (private/not private/etc.). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 NSView* permissionsView_; | 85 NSView* permissionsView_; |
86 | 86 |
87 // Whether the permissionView_ shows anything. | 87 // Whether the permissionView_ shows anything. |
88 BOOL permissionsPresent_; | 88 BOOL permissionsPresent_; |
89 | 89 |
90 // The link button for showing site settings. | 90 // The link button for showing site settings. |
91 NSButton* siteSettingsButton_; | 91 NSButton* siteSettingsButton_; |
92 | 92 |
93 // The UI translates user actions to specific events and forwards them to the | 93 // The UI translates user actions to specific events and forwards them to the |
94 // |presenter_|. The |presenter_| handles these events and updates the UI. | 94 // |presenter_|. The |presenter_| handles these events and updates the UI. |
95 std::unique_ptr<WebsiteSettings> presenter_; | 95 std::unique_ptr<PageInfo> presenter_; |
96 | 96 |
97 // Bridge which implements the WebsiteSettingsUI interface and forwards | 97 // Bridge which implements the PageInfoUI interface and forwards |
98 // methods on to this class. | 98 // methods on to this class. |
99 std::unique_ptr<WebsiteSettingsUIBridge> bridge_; | 99 std::unique_ptr<PageInfoUIBridge> bridge_; |
100 } | 100 } |
101 | 101 |
102 // Designated initializer. The controller will release itself when the bubble | 102 // Designated initializer. The controller will release itself when the bubble |
103 // is closed. |parentWindow| cannot be nil. |webContents| may be nil for | 103 // is closed. |parentWindow| cannot be nil. |webContents| may be nil for |
104 // testing purposes. | 104 // testing purposes. |
105 - (id)initWithParentWindow:(NSWindow*)parentWindow | 105 - (id)initWithParentWindow:(NSWindow*)parentWindow |
106 websiteSettingsUIBridge:(WebsiteSettingsUIBridge*)bridge | 106 PageInfoUIBridge:(PageInfoUIBridge*)bridge |
107 webContents:(content::WebContents*)webContents | 107 webContents:(content::WebContents*)webContents |
108 url:(const GURL&)url; | 108 url:(const GURL&)url; |
109 | 109 |
110 // Return the default width of the window. It may be wider to fit the content. | 110 // Return the default width of the window. It may be wider to fit the content. |
111 // This may be overriden by a subclass for testing purposes. | 111 // This may be overriden by a subclass for testing purposes. |
112 - (CGFloat)defaultWindowWidth; | 112 - (CGFloat)defaultWindowWidth; |
113 | 113 |
114 @end | 114 @end |
115 | 115 |
116 // Provides a bridge between the WebSettingsUI C++ interface and the Cocoa | 116 // Provides a bridge between the WebSettingsUI C++ interface and the Cocoa |
117 // implementation in WebsiteSettingsBubbleController. | 117 // implementation in PageInfoBubbleController. |
118 class WebsiteSettingsUIBridge : public content::WebContentsObserver, | 118 class PageInfoUIBridge : public content::WebContentsObserver, |
119 public WebsiteSettingsUI { | 119 public PageInfoUI { |
120 public: | 120 public: |
121 explicit WebsiteSettingsUIBridge(content::WebContents* web_contents); | 121 explicit PageInfoUIBridge(content::WebContents* web_contents); |
122 ~WebsiteSettingsUIBridge() override; | 122 ~PageInfoUIBridge() override; |
123 | 123 |
124 // Creates a |WebsiteSettingsBubbleController| and displays the UI. |parent| | 124 // Creates a |PageInfoBubbleController| and displays the UI. |parent| |
125 // is the currently active window. |profile| points to the currently active | 125 // is the currently active window. |profile| points to the currently active |
126 // profile. |web_contents| points to the WebContents that wraps the currently | 126 // profile. |web_contents| points to the WebContents that wraps the currently |
127 // active tab. |virtual_url| is the virtual GURL of the currently active | 127 // active tab. |virtual_url| is the virtual GURL of the currently active |
128 // tab. |security_info| is the |security_state::SecurityInfo| of the | 128 // tab. |security_info| is the |security_state::SecurityInfo| of the |
129 // connection to the website in the currently active tab. | 129 // connection to the website in the currently active tab. |
130 static void Show(gfx::NativeWindow parent, | 130 static void Show(gfx::NativeWindow parent, |
131 Profile* profile, | 131 Profile* profile, |
132 content::WebContents* web_contents, | 132 content::WebContents* web_contents, |
133 const GURL& virtual_url, | 133 const GURL& virtual_url, |
134 const security_state::SecurityInfo& security_info); | 134 const security_state::SecurityInfo& security_info); |
135 | 135 |
136 void set_bubble_controller( | 136 void set_bubble_controller(PageInfoBubbleController* bubble_controller); |
137 WebsiteSettingsBubbleController* bubble_controller); | |
138 | 137 |
139 // WebContentsObserver implementation. | 138 // WebContentsObserver implementation. |
140 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 139 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
141 | 140 |
142 // WebsiteSettingsUI implementations. | 141 // PageInfoUI implementations. |
143 void SetCookieInfo(const CookieInfoList& cookie_info_list) override; | 142 void SetCookieInfo(const CookieInfoList& cookie_info_list) override; |
144 void SetPermissionInfo(const PermissionInfoList& permission_info_list, | 143 void SetPermissionInfo(const PermissionInfoList& permission_info_list, |
145 ChosenObjectInfoList chosen_object_info_list) override; | 144 ChosenObjectInfoList chosen_object_info_list) override; |
146 void SetIdentityInfo(const IdentityInfo& identity_info) override; | 145 void SetIdentityInfo(const IdentityInfo& identity_info) override; |
147 | 146 |
148 private: | 147 private: |
149 // The WebContents the bubble UI is attached to. | 148 // The WebContents the bubble UI is attached to. |
150 content::WebContents* web_contents_; | 149 content::WebContents* web_contents_; |
151 | 150 |
152 // The Cocoa controller for the bubble UI. | 151 // The Cocoa controller for the bubble UI. |
153 WebsiteSettingsBubbleController* bubble_controller_; | 152 PageInfoBubbleController* bubble_controller_; |
154 | 153 |
155 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsUIBridge); | 154 DISALLOW_COPY_AND_ASSIGN(PageInfoUIBridge); |
156 }; | 155 }; |
157 | 156 |
158 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONT
ROLLER_H_ | 157 #endif // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONT
ROLLER_H_ |
OLD | NEW |