OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 std::vector<ExtensionAction*> ExtensionsService::GetExtensionActions( | 368 std::vector<ExtensionAction*> ExtensionsService::GetExtensionActions( |
369 ExtensionAction::ExtensionActionType action_type, | 369 ExtensionAction::ExtensionActionType action_type, |
370 bool include_popups) const { | 370 bool include_popups) const { |
371 std::vector<ExtensionAction*> result; | 371 std::vector<ExtensionAction*> result; |
372 | 372 |
373 // TODO(finnur): Sort the icons in some meaningful way. | 373 // TODO(finnur): Sort the icons in some meaningful way. |
374 for (ExtensionList::const_iterator iter = extensions_.begin(); | 374 for (ExtensionList::const_iterator iter = extensions_.begin(); |
375 iter != extensions_.end(); ++iter) { | 375 iter != extensions_.end(); ++iter) { |
376 if (action_type == ExtensionAction::PAGE_ACTION) { | 376 if (action_type == ExtensionAction::PAGE_ACTION) { |
377 const ExtensionActionMap* page_actions = &(*iter)->page_actions(); | 377 ExtensionAction* page_action = (*iter)->page_action(); |
378 for (ExtensionActionMap::const_iterator i(page_actions->begin()); | 378 if (page_action && (include_popups || !page_action->is_popup())) { |
379 i != page_actions->end(); ++i) { | 379 result.push_back(page_action); |
380 if (include_popups || !i->second->is_popup()) | |
381 result.push_back(i->second); | |
382 } | 380 } |
383 } else { | 381 } else { |
384 ExtensionAction* browser_action = (*iter)->browser_action(); | 382 ExtensionAction* browser_action = (*iter)->browser_action(); |
385 if (browser_action && (include_popups || !browser_action->is_popup())) | 383 if (browser_action && (include_popups || !browser_action->is_popup())) |
386 result.push_back(browser_action); | 384 result.push_back(browser_action); |
387 } | 385 } |
388 } | 386 } |
389 | 387 |
390 return result; | 388 return result; |
391 } | 389 } |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 linked_ptr<ExternalExtensionProvider>(test_provider); | 802 linked_ptr<ExternalExtensionProvider>(test_provider); |
805 } | 803 } |
806 | 804 |
807 void ExtensionsServiceBackend::OnExternalExtensionFound( | 805 void ExtensionsServiceBackend::OnExternalExtensionFound( |
808 const std::string& id, const Version* version, const FilePath& path, | 806 const std::string& id, const Version* version, const FilePath& path, |
809 Extension::Location location) { | 807 Extension::Location location) { |
810 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, | 808 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, |
811 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), | 809 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), |
812 path, location)); | 810 path, location)); |
813 } | 811 } |
OLD | NEW |