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" |
11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
12 #include "chrome/browser/extensions/extension_action.h" | 12 #include "chrome/browser/extensions/extension_action.h" |
13 #include "chrome/browser/extensions/extension_action_manager.h" | 13 #include "chrome/browser/extensions/extension_action_manager.h" |
14 #include "chrome/browser/extensions/extension_prefs.h" | 14 #include "chrome/browser/extensions/extension_prefs.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/extension_tab_util.h" | 16 #include "chrome/browser/extensions/extension_tab_util.h" |
17 #include "chrome/browser/extensions/extension_toolbar_model_factory.h" | 17 #include "chrome/browser/extensions/extension_toolbar_model_factory.h" |
18 #include "chrome/browser/extensions/extension_util.h" | 18 #include "chrome/browser/extensions/extension_util.h" |
19 #include "chrome/browser/extensions/tab_helper.h" | 19 #include "chrome/browser/extensions/tab_helper.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
| 28 #include "extensions/common/extension_set.h" |
28 #include "extensions/common/feature_switch.h" | 29 #include "extensions/common/feature_switch.h" |
29 | 30 |
30 using extensions::Extension; | 31 using extensions::Extension; |
31 using extensions::ExtensionIdList; | 32 using extensions::ExtensionIdList; |
32 using extensions::ExtensionList; | 33 using extensions::ExtensionList; |
33 | 34 |
34 bool ExtensionToolbarModel::Observer::BrowserActionShowPopup( | 35 bool ExtensionToolbarModel::Observer::BrowserActionShowPopup( |
35 const extensions::Extension* extension) { | 36 const extensions::Extension* extension) { |
36 return false; | 37 return false; |
37 } | 38 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Items that have explicit positions. | 330 // Items that have explicit positions. |
330 ExtensionList sorted; | 331 ExtensionList sorted; |
331 sorted.resize(positions.size(), NULL); | 332 sorted.resize(positions.size(), NULL); |
332 // The items that don't have explicit positions. | 333 // The items that don't have explicit positions. |
333 ExtensionList unsorted; | 334 ExtensionList unsorted; |
334 | 335 |
335 extensions::ExtensionActionManager* extension_action_manager = | 336 extensions::ExtensionActionManager* extension_action_manager = |
336 extensions::ExtensionActionManager::Get(profile_); | 337 extensions::ExtensionActionManager::Get(profile_); |
337 | 338 |
338 // Create the lists. | 339 // Create the lists. |
339 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 340 for (extensions::ExtensionSet::const_iterator it = |
| 341 service->extensions()->begin(); |
340 it != service->extensions()->end(); ++it) { | 342 it != service->extensions()->end(); ++it) { |
341 const Extension* extension = it->get(); | 343 const Extension* extension = it->get(); |
342 if (!extension_action_manager->GetBrowserAction(*extension)) | 344 if (!extension_action_manager->GetBrowserAction(*extension)) |
343 continue; | 345 continue; |
344 if (!extensions::ExtensionActionAPI::GetBrowserActionVisibility( | 346 if (!extensions::ExtensionActionAPI::GetBrowserActionVisibility( |
345 extension_prefs_, extension->id())) { | 347 extension_prefs_, extension->id())) { |
346 continue; | 348 continue; |
347 } | 349 } |
348 | 350 |
349 extensions::ExtensionIdList::const_iterator pos = | 351 extensions::ExtensionIdList::const_iterator pos = |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 const extensions::Extension* extension) { | 463 const extensions::Extension* extension) { |
462 ObserverListBase<Observer>::Iterator it(observers_); | 464 ObserverListBase<Observer>::Iterator it(observers_); |
463 Observer* obs = NULL; | 465 Observer* obs = NULL; |
464 while ((obs = it.GetNext()) != NULL) { | 466 while ((obs = it.GetNext()) != NULL) { |
465 // Stop after first popup since it should only show in the active window. | 467 // Stop after first popup since it should only show in the active window. |
466 if (obs->BrowserActionShowPopup(extension)) | 468 if (obs->BrowserActionShowPopup(extension)) |
467 return true; | 469 return true; |
468 } | 470 } |
469 return false; | 471 return false; |
470 } | 472 } |
OLD | NEW |