Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Side by Side Diff: chrome/common/extensions/api/extension_action/page_action_handler.cc

Issue 12618009: Move SystemIndicator parsing out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/extensions/api/extension_action/page_action_handler.h" 5 #include "chrome/common/extensions/api/extension_action/page_action_handler.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/common/extensions/extension_constants.h" 10 #include "chrome/common/extensions/extension_constants.h"
11 #include "chrome/common/extensions/extension_file_util.h" 11 #include "chrome/common/extensions/extension_file_util.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h" 12 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/manifest_handler_helpers.h"
14 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
15 14
16 namespace keys = extension_manifest_keys; 15 namespace keys = extension_manifest_keys;
17 namespace errors = extension_manifest_errors; 16 namespace errors = extension_manifest_errors;
18 17
19 namespace extensions { 18 namespace extensions {
20 19
21 PageActionHandler::PageActionHandler() { 20 PageActionHandler::PageActionHandler() {
22 } 21 }
23 22
(...skipping 28 matching lines...) Expand all
52 } else if (extension->manifest()->HasKey(keys::kPageAction)) { 51 } else if (extension->manifest()->HasKey(keys::kPageAction)) {
53 if (!extension->manifest()->GetDictionary(keys::kPageAction, 52 if (!extension->manifest()->GetDictionary(keys::kPageAction,
54 &page_action_value)) { 53 &page_action_value)) {
55 *error = ASCIIToUTF16(errors::kInvalidPageAction); 54 *error = ASCIIToUTF16(errors::kInvalidPageAction);
56 return false; 55 return false;
57 } 56 }
58 } 57 }
59 58
60 // If page_action_value is not NULL, then there was a valid page action. 59 // If page_action_value is not NULL, then there was a valid page action.
61 if (page_action_value) { 60 if (page_action_value) {
62 page_action_info = manifest_handler_helpers::LoadActionInfo( 61 page_action_info = ActionInfo::Load(extension, page_action_value, error);
63 extension, page_action_value, error);
64 if (!page_action_info) 62 if (!page_action_info)
65 return false; // Failed to parse page action definition. 63 return false; // Failed to parse page action definition.
66 } 64 }
67 ActionInfo::SetPageActionInfo(extension, page_action_info.release()); 65 ActionInfo::SetPageActionInfo(extension, page_action_info.release());
68 66
69 return true; 67 return true;
70 } 68 }
71 69
72 bool PageActionHandler::Validate(const Extension* extension, 70 bool PageActionHandler::Validate(const Extension* extension,
73 std::string* error, 71 std::string* error,
(...skipping 12 matching lines...) Expand all
86 } 84 }
87 85
88 const std::vector<std::string> PageActionHandler::Keys() const { 86 const std::vector<std::string> PageActionHandler::Keys() const {
89 std::vector<std::string> keys; 87 std::vector<std::string> keys;
90 keys.push_back(keys::kPageAction); 88 keys.push_back(keys::kPageAction);
91 keys.push_back(keys::kPageActions); 89 keys.push_back(keys::kPageActions);
92 return keys; 90 return keys;
93 } 91 }
94 92
95 } // namespace extensions 93 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698