| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extensions/extension_message_bubble_controller.h" | 5 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_message_bubble.h" | 12 #include "chrome/browser/extensions/extension_message_bubble.h" |
| 13 #include "chrome/browser/extensions/extension_toolbar_model.h" | |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
| 19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
| 20 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 21 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "grit/components_strings.h" | 22 #include "grit/components_strings.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return *GetOrCreateExtensionList(); | 155 return *GetOrCreateExtensionList(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; } | 158 bool ExtensionMessageBubbleController::CloseOnDeactivate() { return false; } |
| 159 | 159 |
| 160 void ExtensionMessageBubbleController::HighlightExtensionsIfNecessary() { | 160 void ExtensionMessageBubbleController::HighlightExtensionsIfNecessary() { |
| 161 if (delegate_->ShouldHighlightExtensions() && !did_highlight_) { | 161 if (delegate_->ShouldHighlightExtensions() && !did_highlight_) { |
| 162 did_highlight_ = true; | 162 did_highlight_ = true; |
| 163 const ExtensionIdList& extension_ids = GetExtensionIdList(); | 163 const ExtensionIdList& extension_ids = GetExtensionIdList(); |
| 164 DCHECK(!extension_ids.empty()); | 164 DCHECK(!extension_ids.empty()); |
| 165 ExtensionToolbarModel::Get(profile())->HighlightExtensions( | 165 ToolbarActionsModel::Get(profile())->HighlightActions( |
| 166 extension_ids, ExtensionToolbarModel::HIGHLIGHT_WARNING); | 166 extension_ids, ToolbarActionsModel::HIGHLIGHT_WARNING); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) { | 170 void ExtensionMessageBubbleController::Show(ExtensionMessageBubble* bubble) { |
| 171 bubble->Show(); | 171 bubble->Show(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ExtensionMessageBubbleController::OnBubbleAction() { | 174 void ExtensionMessageBubbleController::OnBubbleAction() { |
| 175 DCHECK_EQ(ACTION_BOUNDARY, user_action_); | 175 DCHECK_EQ(ACTION_BOUNDARY, user_action_); |
| 176 user_action_ = ACTION_EXECUTE; | 176 user_action_ = ACTION_EXECUTE; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 delegate_->LogExtensionCount(extension_list_.size()); | 241 delegate_->LogExtensionCount(extension_list_.size()); |
| 242 initialized_ = true; | 242 initialized_ = true; |
| 243 } | 243 } |
| 244 | 244 |
| 245 return &extension_list_; | 245 return &extension_list_; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void ExtensionMessageBubbleController::OnClose() { | 248 void ExtensionMessageBubbleController::OnClose() { |
| 249 AcknowledgeExtensions(); | 249 AcknowledgeExtensions(); |
| 250 if (did_highlight_) | 250 if (did_highlight_) |
| 251 ExtensionToolbarModel::Get(profile())->StopHighlighting(); | 251 ToolbarActionsModel::Get(profile())->StopHighlighting(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace extensions | 254 } // namespace extensions |
| OLD | NEW |