OLD | NEW |
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 CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 6 #define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 18 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
19 #include "chrome/common/custom_handlers/protocol_handler.h" | 19 #include "chrome/common/custom_handlers/protocol_handler.h" |
20 #include "components/content_settings/core/common/content_settings.h" | 20 #include "components/content_settings/core/common/content_settings.h" |
21 #include "components/content_settings/core/common/content_settings_types.h" | 21 #include "components/content_settings/core/common/content_settings_types.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/common/media_stream_request.h" | 24 #include "content/public/common/media_stream_request.h" |
25 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
27 | 27 |
| 28 #if defined(OS_MACOSX) |
| 29 class LocationBarDecoration; |
| 30 #endif |
| 31 |
28 class ContentSettingBubbleModelDelegate; | 32 class ContentSettingBubbleModelDelegate; |
29 class Profile; | 33 class Profile; |
30 class ProtocolHandlerRegistry; | 34 class ProtocolHandlerRegistry; |
31 | 35 |
32 namespace content { | 36 namespace content { |
33 class WebContents; | 37 class WebContents; |
34 } | 38 } |
35 | 39 |
36 namespace rappor { | 40 namespace rappor { |
37 class RapporServiceImpl; | 41 class RapporServiceImpl; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 186 |
183 // Cast this bubble into ContentSettingDownloadsBubbleModel if possible. | 187 // Cast this bubble into ContentSettingDownloadsBubbleModel if possible. |
184 virtual ContentSettingDownloadsBubbleModel* AsDownloadsBubbleModel(); | 188 virtual ContentSettingDownloadsBubbleModel* AsDownloadsBubbleModel(); |
185 | 189 |
186 // Sets the Rappor service used for testing. | 190 // Sets the Rappor service used for testing. |
187 void SetRapporServiceImplForTesting( | 191 void SetRapporServiceImplForTesting( |
188 rappor::RapporServiceImpl* rappor_service) { | 192 rappor::RapporServiceImpl* rappor_service) { |
189 rappor_service_ = rappor_service; | 193 rappor_service_ = rappor_service; |
190 } | 194 } |
191 | 195 |
| 196 #if defined(OS_MACOSX) |
| 197 LocationBarDecoration* decoration() const { return decoration_; } |
| 198 |
| 199 void set_decoration(LocationBarDecoration* decoration) { |
| 200 decoration_ = decoration; |
| 201 } |
| 202 #endif |
| 203 |
192 static const int kAllowButtonIndex; | 204 static const int kAllowButtonIndex; |
193 | 205 |
194 protected: | 206 protected: |
195 ContentSettingBubbleModel( | 207 ContentSettingBubbleModel( |
196 Delegate* delegate, | 208 Delegate* delegate, |
197 content::WebContents* web_contents, | 209 content::WebContents* web_contents, |
198 Profile* profile); | 210 Profile* profile); |
199 | 211 |
200 content::WebContents* web_contents() const { return web_contents_; } | 212 content::WebContents* web_contents() const { return web_contents_; } |
201 Profile* profile() const { return profile_; } | 213 Profile* profile() const { return profile_; } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 261 |
250 content::WebContents* web_contents_; | 262 content::WebContents* web_contents_; |
251 Profile* profile_; | 263 Profile* profile_; |
252 Delegate* delegate_; | 264 Delegate* delegate_; |
253 BubbleContent bubble_content_; | 265 BubbleContent bubble_content_; |
254 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. | 266 // A registrar for listening for WEB_CONTENTS_DESTROYED notifications. |
255 content::NotificationRegistrar registrar_; | 267 content::NotificationRegistrar registrar_; |
256 // The service used to record Rappor metrics. Can be set for testing. | 268 // The service used to record Rappor metrics. Can be set for testing. |
257 rappor::RapporServiceImpl* rappor_service_; | 269 rappor::RapporServiceImpl* rappor_service_; |
258 | 270 |
| 271 #if defined(OS_MACOSX) |
| 272 // The omnibox decoration that the bubble is anchored to. |
| 273 LocationBarDecoration* decoration_ = nullptr; |
| 274 #endif |
259 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); | 275 DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleModel); |
260 }; | 276 }; |
261 | 277 |
262 // A generic bubble used for a single content setting. | 278 // A generic bubble used for a single content setting. |
263 class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { | 279 class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { |
264 public: | 280 public: |
265 ContentSettingSimpleBubbleModel(Delegate* delegate, | 281 ContentSettingSimpleBubbleModel(Delegate* delegate, |
266 content::WebContents* web_contents, | 282 content::WebContents* web_contents, |
267 Profile* profile, | 283 Profile* profile, |
268 ContentSettingsType content_type); | 284 ContentSettingsType content_type); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void SetTitle() override; | 431 void SetTitle() override; |
416 void SetManageText() override; | 432 void SetManageText() override; |
417 void OnManageLinkClicked() override; | 433 void OnManageLinkClicked() override; |
418 | 434 |
419 int selected_item_ = 0; | 435 int selected_item_ = 0; |
420 | 436 |
421 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); | 437 DISALLOW_COPY_AND_ASSIGN(ContentSettingDownloadsBubbleModel); |
422 }; | 438 }; |
423 | 439 |
424 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ | 440 #endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_MODEL_H_ |
OLD | NEW |