OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/settings_api_bubble_controller.h" | 5 #include "chrome/browser/extensions/settings_api_bubble_controller.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_toolbar_model.h" | 9 #include "chrome/browser/extensions/extension_toolbar_model.h" |
10 #include "chrome/browser/extensions/settings_api_helpers.h" | 10 #include "chrome/browser/extensions/settings_api_helpers.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); | 88 registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
89 if (!extension) | 89 if (!extension) |
90 return false; // The extension provided is no longer enabled. | 90 return false; // The extension provided is no longer enabled. |
91 | 91 |
92 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); | 92 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); |
93 if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id)) | 93 if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id)) |
94 return false; | 94 return false; |
95 | 95 |
96 const Extension* override = NULL; | 96 const Extension* override = NULL; |
97 switch (type_) { | 97 switch (type_) { |
98 case BUBBLE_TYPE_HOME_PAGE: | 98 case extensions::BUBBLE_TYPE_HOME_PAGE: |
99 override = GetExtensionOverridingHomepage(profile_, NULL); | 99 override = extensions::GetExtensionOverridingHomepage(profile_); |
100 break; | 100 break; |
101 case BUBBLE_TYPE_STARTUP_PAGES: | 101 case extensions::BUBBLE_TYPE_STARTUP_PAGES: |
102 override = GetExtensionOverridingStartupPages(profile_, NULL); | 102 override = extensions::GetExtensionOverridingStartupPages(profile_); |
103 break; | 103 break; |
104 case BUBBLE_TYPE_SEARCH_ENGINE: | 104 case extensions::BUBBLE_TYPE_SEARCH_ENGINE: |
105 override = GetExtensionOverridingSearchEngine(profile_, NULL); | 105 override = extensions::GetExtensionOverridingSearchEngine(profile_); |
106 break; | 106 break; |
107 } | 107 } |
108 | 108 |
109 if (!override || override->id() != extension->id()) | 109 if (!override || override->id() != extension->id()) |
110 return false; | 110 return false; |
111 | 111 |
112 extension_id_ = extension_id; | 112 extension_id_ = extension_id; |
113 return true; | 113 return true; |
114 } | 114 } |
115 | 115 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return true; | 306 return true; |
307 } | 307 } |
308 | 308 |
309 bool SettingsApiBubbleController::CloseOnDeactivate() { | 309 bool SettingsApiBubbleController::CloseOnDeactivate() { |
310 // Startup bubbles tend to get lost in the focus storm that happens on | 310 // Startup bubbles tend to get lost in the focus storm that happens on |
311 // startup. Other types should dismiss on focus loss. | 311 // startup. Other types should dismiss on focus loss. |
312 return type_ != BUBBLE_TYPE_STARTUP_PAGES; | 312 return type_ != BUBBLE_TYPE_STARTUP_PAGES; |
313 } | 313 } |
314 | 314 |
315 } // namespace extensions | 315 } // namespace extensions |
OLD | NEW |