OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
20 #include "chrome/browser/ui/views/browser_dialogs.h" | 20 #include "chrome/browser/ui/views/browser_dialogs.h" |
21 #include "content/browser/plugin_service.h" | |
22 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
23 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
24 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
| 24 #include "content/public/browser/plugin_service.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/views/controls/button/radio_button.h" | 27 #include "ui/views/controls/button/radio_button.h" |
28 #include "ui/views/controls/button/text_button.h" | 28 #include "ui/views/controls/button/text_button.h" |
29 #include "ui/views/controls/image_view.h" | 29 #include "ui/views/controls/image_view.h" |
30 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
31 #include "ui/views/controls/link.h" | 31 #include "ui/views/controls/link.h" |
32 #include "ui/views/controls/separator.h" | 32 #include "ui/views/controls/separator.h" |
33 #include "ui/views/layout/grid_layout.h" | 33 #include "ui/views/layout/grid_layout.h" |
34 #include "ui/views/layout/layout_constants.h" | 34 #include "ui/views/layout/layout_constants.h" |
35 | 35 |
36 #if defined(TOOLKIT_USES_GTK) | 36 #if defined(TOOLKIT_USES_GTK) |
37 #include "ui/gfx/gtk_util.h" | 37 #include "ui/gfx/gtk_util.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(USE_AURA) | 40 #if defined(USE_AURA) |
41 #include "ui/aura/cursor.h" | 41 #include "ui/aura/cursor.h" |
42 #endif | 42 #endif |
43 | 43 |
44 // If we don't clamp the maximum width, then very long URLs and titles can make | 44 // If we don't clamp the maximum width, then very long URLs and titles can make |
45 // the bubble arbitrarily wide. | 45 // the bubble arbitrarily wide. |
46 const int kMaxContentsWidth = 500; | 46 const int kMaxContentsWidth = 500; |
47 | 47 |
48 // When we have multiline labels, we should set a minimum width lest we get very | 48 // When we have multiline labels, we should set a minimum width lest we get very |
49 // narrow bubbles with lots of line-wrapping. | 49 // narrow bubbles with lots of line-wrapping. |
50 const int kMinMultiLineContentsWidth = 250; | 50 const int kMinMultiLineContentsWidth = 250; |
51 | 51 |
| 52 using content::PluginService; |
| 53 |
52 class ContentSettingBubbleContents::Favicon : public views::ImageView { | 54 class ContentSettingBubbleContents::Favicon : public views::ImageView { |
53 public: | 55 public: |
54 Favicon(const SkBitmap& image, | 56 Favicon(const SkBitmap& image, |
55 ContentSettingBubbleContents* parent, | 57 ContentSettingBubbleContents* parent, |
56 views::Link* link); | 58 views::Link* link); |
57 virtual ~Favicon(); | 59 virtual ~Favicon(); |
58 | 60 |
59 private: | 61 private: |
60 // views::View overrides: | 62 // views::View overrides: |
61 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 63 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 333 } |
332 | 334 |
333 void ContentSettingBubbleContents::Observe( | 335 void ContentSettingBubbleContents::Observe( |
334 int type, | 336 int type, |
335 const content::NotificationSource& source, | 337 const content::NotificationSource& source, |
336 const content::NotificationDetails& details) { | 338 const content::NotificationDetails& details) { |
337 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); | 339 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); |
338 DCHECK(source == content::Source<TabContents>(tab_contents_)); | 340 DCHECK(source == content::Source<TabContents>(tab_contents_)); |
339 tab_contents_ = NULL; | 341 tab_contents_ = NULL; |
340 } | 342 } |
OLD | NEW |