| 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/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 SetAccessibilityFocusable(true); |
| 28 LocationBarView::InitTouchableLocationBarChildView(this); | 28 LocationBarView::InitTouchableLocationBarChildView(this); |
| 29 } | 29 } |
| 30 | 30 |
| 31 ScriptBubbleIconView::~ScriptBubbleIconView() { | 31 ScriptBubbleIconView::~ScriptBubbleIconView() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ScriptBubbleIconView::SetScriptCount(size_t script_count) { | 34 void ScriptBubbleIconView::SetScriptCount(size_t script_count) { |
| 35 script_count_ = script_count; | 35 script_count_ = script_count; |
| 36 gfx::ImageSkia* icon = | 36 gfx::ImageSkia* icon = |
| 37 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 37 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 event->SetHandled(); | 87 event->SetHandled(); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, | 91 void ScriptBubbleIconView::ShowScriptBubble(views::View* anchor_view, |
| 92 WebContents* web_contents) { | 92 WebContents* web_contents) { |
| 93 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, | 93 ScriptBubbleView* script_bubble = new ScriptBubbleView(anchor_view, |
| 94 web_contents); | 94 web_contents); |
| 95 views::BubbleDelegateView::CreateBubble(script_bubble)->Show(); | 95 views::BubbleDelegateView::CreateBubble(script_bubble)->Show(); |
| 96 } | 96 } |
| OLD | NEW |