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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h

Issue 1317443002: Fix UAF in Origin Info Bubble and permission settings UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix another Andorid call site. Checked all call sites. Created 5 years, 3 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
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
10 #include "chrome/browser/ui/website_settings/website_settings_ui.h" 10 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
11 #include "content/public/browser/web_contents_observer.h"
11 12
12 class WebsiteSettingsUIBridge; 13 class WebsiteSettingsUIBridge;
13 14
14 namespace content { 15 namespace content {
15 class WebContents; 16 class WebContents;
16 } 17 }
17 18
18 // This NSWindowController subclass manages the InfoBubbleWindow and view that 19 // This NSWindowController subclass manages the InfoBubbleWindow and view that
19 // are displayed when the user clicks the favicon or security lock icon. 20 // are displayed when the user clicks the favicon or security lock icon.
20 // 21 //
21 // TODO(palmer, sashab): Normalize all WebsiteSettings*, SiteSettings*, 22 // TODO(palmer): Normalize all WebsiteSettings*, SiteSettings*, PageInfo*, et c.
22 // PageInfo*, et c. to OriginInfo*. 23 // to OriginInfo*.
23 @interface WebsiteSettingsBubbleController : BaseBubbleController { 24 @interface WebsiteSettingsBubbleController : BaseBubbleController {
24 @private 25 @private
25 content::WebContents* webContents_; 26 content::WebContents* webContents_;
26 27
27 base::scoped_nsobject<NSView> contentView_; 28 base::scoped_nsobject<NSView> contentView_;
28 base::scoped_nsobject<NSSegmentedControl> segmentedControl_; 29 base::scoped_nsobject<NSSegmentedControl> segmentedControl_;
29 base::scoped_nsobject<NSTabView> tabView_; 30 base::scoped_nsobject<NSTabView> tabView_;
30 31
31 // Displays the web site identity. 32 // Displays the web site identity.
32 NSTextField* identityField_; 33 NSTextField* identityField_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 isInternalPage:(BOOL)isInternalPage; 93 isInternalPage:(BOOL)isInternalPage;
93 94
94 // Return the default width of the window. It may be wider to fit the content. 95 // Return the default width of the window. It may be wider to fit the content.
95 // This may be overriden by a subclass for testing purposes. 96 // This may be overriden by a subclass for testing purposes.
96 - (CGFloat)defaultWindowWidth; 97 - (CGFloat)defaultWindowWidth;
97 98
98 @end 99 @end
99 100
100 // Provides a bridge between the WebSettingsUI C++ interface and the Cocoa 101 // Provides a bridge between the WebSettingsUI C++ interface and the Cocoa
101 // implementation in WebsiteSettingsBubbleController. 102 // implementation in WebsiteSettingsBubbleController.
102 class WebsiteSettingsUIBridge : public WebsiteSettingsUI { 103 class WebsiteSettingsUIBridge : public content::WebContentsObserver,
104 public WebsiteSettingsUI {
103 public: 105 public:
104 WebsiteSettingsUIBridge(); 106 explicit WebsiteSettingsUIBridge(content::WebContents* web_contents);
105 ~WebsiteSettingsUIBridge() override; 107 ~WebsiteSettingsUIBridge() override;
106 108
107 // Creates a |WebsiteSettingsBubbleController| and displays the UI. |parent| 109 // Creates a |WebsiteSettingsBubbleController| and displays the UI. |parent|
108 // is the currently active window. |profile| points to the currently active 110 // is the currently active window. |profile| points to the currently active
109 // profile. |web_contents| points to the WebContents that wraps the currently 111 // profile. |web_contents| points to the WebContents that wraps the currently
110 // active tab. |url| is the GURL of the currently active tab. |ssl| is the 112 // active tab. |url| is the GURL of the currently active tab. |ssl| is the
111 // |SSLStatus| of the connection to the website in the currently active tab. 113 // |SSLStatus| of the connection to the website in the currently active tab.
112 static void Show(gfx::NativeWindow parent, 114 static void Show(gfx::NativeWindow parent,
113 Profile* profile, 115 Profile* profile,
114 content::WebContents* web_contents, 116 content::WebContents* web_contents,
115 const GURL& url, 117 const GURL& url,
116 const content::SSLStatus& ssl); 118 const content::SSLStatus& ssl);
117 119
118 void set_bubble_controller( 120 void set_bubble_controller(
119 WebsiteSettingsBubbleController* bubble_controller); 121 WebsiteSettingsBubbleController* bubble_controller);
120 122
123 // WebContentsObserver implementation.
124 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
125
121 // WebsiteSettingsUI implementations. 126 // WebsiteSettingsUI implementations.
122 void SetCookieInfo(const CookieInfoList& cookie_info_list) override; 127 void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
123 void SetPermissionInfo( 128 void SetPermissionInfo(
124 const PermissionInfoList& permission_info_list) override; 129 const PermissionInfoList& permission_info_list) override;
125 void SetIdentityInfo(const IdentityInfo& identity_info) override; 130 void SetIdentityInfo(const IdentityInfo& identity_info) override;
126 void SetSelectedTab(TabId tab_id) override; 131 void SetSelectedTab(TabId tab_id) override;
127 132
128 private: 133 private:
134 // The WebContents the bubble UI is attached to.
135 content::WebContents* web_contents_;
136
129 // The Cocoa controller for the bubble UI. 137 // The Cocoa controller for the bubble UI.
130 WebsiteSettingsBubbleController* bubble_controller_; 138 WebsiteSettingsBubbleController* bubble_controller_;
131 139
132 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsUIBridge); 140 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsUIBridge);
133 }; 141 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698