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 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
9 #include "chrome/browser/ui/views/script_bubble_view.h" | 9 #include "chrome/browser/ui/views/script_bubble_view.h" |
| 10 #include "chrome/common/extensions/api/extension_action/action_info.h" |
10 #include "chrome/common/icon_with_badge_image_source.h" | 11 #include "chrome/common/icon_with_badge_image_source.h" |
11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
12 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
13 #include "ui/base/accessibility/accessible_view_state.h" | 14 #include "ui/base/accessibility/accessible_view_state.h" |
14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
17 | 18 |
18 using content::WebContents; | 19 using content::WebContents; |
19 | 20 |
(...skipping 22 matching lines...) Expand all Loading... |
42 gfx::Size requested_size(19, 19); // Icon is only 16x16, too small to badge. | 43 gfx::Size requested_size(19, 19); // Icon is only 16x16, too small to badge. |
43 | 44 |
44 gfx::ImageSkia image = gfx::ImageSkia( | 45 gfx::ImageSkia image = gfx::ImageSkia( |
45 new IconWithBadgeImageSource( | 46 new IconWithBadgeImageSource( |
46 *icon, | 47 *icon, |
47 requested_size, | 48 requested_size, |
48 gfx::Size(0, 2), | 49 gfx::Size(0, 2), |
49 base::IntToString(script_count_), | 50 base::IntToString(script_count_), |
50 SkColor(), | 51 SkColor(), |
51 SkColorSetRGB(0, 170, 0), | 52 SkColorSetRGB(0, 170, 0), |
52 extensions::Extension::ActionInfo::TYPE_PAGE), | 53 extensions::ActionInfo::TYPE_PAGE), |
53 requested_size); | 54 requested_size); |
54 | 55 |
55 SetImage(image); | 56 SetImage(image); |
56 } | 57 } |
57 | 58 |
58 void ScriptBubbleIconView::Layout() { | 59 void ScriptBubbleIconView::Layout() { |
59 SetScriptCount(script_count_); | 60 SetScriptCount(script_count_); |
60 } | 61 } |
61 | 62 |
62 void ScriptBubbleIconView::GetAccessibleState(ui::AccessibleViewState* state) { | 63 void ScriptBubbleIconView::GetAccessibleState(ui::AccessibleViewState* state) { |
(...skipping 28 matching lines...) Expand all Loading... |
91 } | 92 } |
92 } | 93 } |
93 | 94 |
94 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, | 95 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, |
95 WebContents* web_contents) { | 96 WebContents* web_contents) { |
96 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, | 97 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, |
97 web_contents); | 98 web_contents); |
98 views::BubbleDelegateView::CreateBubble(script_bubble); | 99 views::BubbleDelegateView::CreateBubble(script_bubble); |
99 script_bubble->Show(); | 100 script_bubble->Show(); |
100 } | 101 } |
OLD | NEW |