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/extensions/extension_toolbar_model.h" | 5 #include "chrome/browser/extensions/extension_toolbar_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/common/extensions/feature_switch.h" | 23 #include "chrome/common/extensions/feature_switch.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 | 28 |
29 using extensions::Extension; | 29 using extensions::Extension; |
30 using extensions::ExtensionIdList; | 30 using extensions::ExtensionIdList; |
31 using extensions::ExtensionList; | 31 using extensions::ExtensionList; |
32 | 32 |
33 namespace { | |
34 | |
35 // Returns true if an |extension| is in an |extension_list|. | |
36 bool IsInExtensionList(const Extension* extension, | |
37 const extensions::ExtensionList& extension_list) { | |
38 for (size_t i = 0; i < extension_list.size(); i++) { | |
39 if (extension_list[i].get() == extension) | |
40 return true; | |
41 } | |
42 return false; | |
43 } | |
44 | |
45 } // namespace | |
46 | |
47 bool ExtensionToolbarModel::Observer::BrowserActionShowPopup( | 33 bool ExtensionToolbarModel::Observer::BrowserActionShowPopup( |
48 const extensions::Extension* extension) { | 34 const extensions::Extension* extension) { |
49 return false; | 35 return false; |
50 } | 36 } |
51 | 37 |
52 ExtensionToolbarModel::ExtensionToolbarModel(ExtensionService* service) | 38 ExtensionToolbarModel::ExtensionToolbarModel(ExtensionService* service) |
53 : service_(service), | 39 : service_(service), |
54 prefs_(service->profile()->GetPrefs()), | 40 prefs_(service->profile()->GetPrefs()), |
55 extensions_initialized_(false), | 41 extensions_initialized_(false), |
56 weak_ptr_factory_(this) { | 42 weak_ptr_factory_(this) { |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 const extensions::Extension* extension) { | 456 const extensions::Extension* extension) { |
471 ObserverListBase<Observer>::Iterator it(observers_); | 457 ObserverListBase<Observer>::Iterator it(observers_); |
472 Observer* obs = NULL; | 458 Observer* obs = NULL; |
473 while ((obs = it.GetNext()) != NULL) { | 459 while ((obs = it.GetNext()) != NULL) { |
474 // Stop after first popup since it should only show in the active window. | 460 // Stop after first popup since it should only show in the active window. |
475 if (obs->BrowserActionShowPopup(extension)) | 461 if (obs->BrowserActionShowPopup(extension)) |
476 return true; | 462 return true; |
477 } | 463 } |
478 return false; | 464 return false; |
479 } | 465 } |
OLD | NEW |