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

Side by Side Diff: chrome/browser/ui/views/location_bar/script_bubble_icon_view.cc

Issue 21696003: views/location_bar: Eliminate TouchableLocationBarView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix wrapping Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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/strings/string_number_conversions.h" 7 #include "base/strings/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/extensions/api/extension_action/action_info.h"
11 #include "chrome/common/icon_with_badge_image_source.h" 11 #include "chrome/common/icon_with_badge_image_source.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
14 #include "ui/base/accessibility/accessible_view_state.h" 14 #include "ui/base/accessibility/accessible_view_state.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 18
19 using content::WebContents; 19 using content::WebContents;
20 20
21 ScriptBubbleIconView::ScriptBubbleIconView( 21 ScriptBubbleIconView::ScriptBubbleIconView(
22 LocationBarView::Delegate* location_bar_delegate) 22 LocationBarView::Delegate* location_bar_delegate)
23 : location_bar_delegate_(location_bar_delegate), 23 : location_bar_delegate_(location_bar_delegate),
24 script_count_(0) { 24 script_count_(0) {
25 set_id(VIEW_ID_SCRIPT_BUBBLE); 25 set_id(VIEW_ID_SCRIPT_BUBBLE);
26 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_SCRIPT_BUBBLE)); 26 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_SCRIPT_BUBBLE));
27 set_accessibility_focusable(true); 27 set_accessibility_focusable(true);
28 TouchableLocationBarView::Init(this); 28 LocationBarView::InitTouchableLocationBarChildView(this);
29 } 29 }
30 30
31 ScriptBubbleIconView::~ScriptBubbleIconView() { 31 ScriptBubbleIconView::~ScriptBubbleIconView() {
32 } 32 }
33 33
34 int ScriptBubbleIconView::GetBuiltInHorizontalPadding() const {
35 return GetBuiltInHorizontalPaddingImpl();
36 }
37
38 void ScriptBubbleIconView::SetScriptCount(size_t script_count) { 34 void ScriptBubbleIconView::SetScriptCount(size_t script_count) {
39 script_count_ = script_count; 35 script_count_ = script_count;
40 gfx::ImageSkia* icon = 36 gfx::ImageSkia* icon =
41 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 37 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
42 IDR_EXTENSIONS_SCRIPT_BUBBLE); 38 IDR_EXTENSIONS_SCRIPT_BUBBLE);
43 gfx::Size requested_size(19, 19); // Icon is only 16x16, too small to badge. 39 gfx::Size requested_size(19, 19); // Icon is only 16x16, too small to badge.
44 40
45 gfx::ImageSkia image = gfx::ImageSkia( 41 gfx::ImageSkia image = gfx::ImageSkia(
46 new IconWithBadgeImageSource( 42 new IconWithBadgeImageSource(
47 *icon, 43 *icon,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 event->SetHandled(); 87 event->SetHandled();
92 } 88 }
93 } 89 }
94 90
95 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, 91 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view,
96 WebContents* web_contents) { 92 WebContents* web_contents) {
97 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, 93 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view,
98 web_contents); 94 web_contents);
99 views::BubbleDelegateView::CreateBubble(script_bubble)->Show(); 95 views::BubbleDelegateView::CreateBubble(script_bubble)->Show();
100 } 96 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/script_bubble_icon_view.h ('k') | chrome/browser/ui/views/location_bar/star_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698