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

Side by Side Diff: chrome/common/extensions/api/system_indicator/system_indicator_handler.cc

Issue 23744004: Move the rest of extension_manifest_constants to top-level extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 7 years, 3 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/system_indicator/system_indicator_handler .h" 5 #include "chrome/common/extensions/api/system_indicator/system_indicator_handler .h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/api/extension_action/action_info.h" 10 #include "chrome/common/extensions/api/extension_action/action_info.h"
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/permissions/api_permission_set.h" 12 #include "chrome/common/extensions/permissions/api_permission_set.h"
14 #include "chrome/common/extensions/permissions/permissions_data.h" 13 #include "chrome/common/extensions/permissions/permissions_data.h"
14 #include "extensions/common/manifest_constants.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 SystemIndicatorHandler::SystemIndicatorHandler() { 18 SystemIndicatorHandler::SystemIndicatorHandler() {
19 } 19 }
20 20
21 SystemIndicatorHandler::~SystemIndicatorHandler() { 21 SystemIndicatorHandler::~SystemIndicatorHandler() {
22 } 22 }
23 23
24 bool SystemIndicatorHandler::Parse(Extension* extension, string16* error) { 24 bool SystemIndicatorHandler::Parse(Extension* extension, string16* error) {
25 const base::DictionaryValue* system_indicator_value = NULL; 25 const base::DictionaryValue* system_indicator_value = NULL;
26 if (!extension->manifest()->GetDictionary( 26 if (!extension->manifest()->GetDictionary(
27 manifest_keys::kSystemIndicator, &system_indicator_value)) { 27 manifest_keys::kSystemIndicator, &system_indicator_value)) {
28 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidSystemIndicator); 28 *error = ASCIIToUTF16(manifest_errors::kInvalidSystemIndicator);
29 return false; 29 return false;
30 } 30 }
31 31
32 scoped_ptr<ActionInfo> action_info = ActionInfo::Load( 32 scoped_ptr<ActionInfo> action_info = ActionInfo::Load(
33 extension, system_indicator_value, error); 33 extension, system_indicator_value, error);
34 34
35 if (!action_info.get()) 35 if (!action_info.get())
36 return false; 36 return false;
37 37
38 // Because the manifest was successfully parsed, auto-grant the permission. 38 // Because the manifest was successfully parsed, auto-grant the permission.
39 // TODO(dewittj) Add this for all extension action APIs. 39 // TODO(dewittj) Add this for all extension action APIs.
40 PermissionsData::GetInitialAPIPermissions(extension)->insert( 40 PermissionsData::GetInitialAPIPermissions(extension)->insert(
41 APIPermission::kSystemIndicator); 41 APIPermission::kSystemIndicator);
42 42
43 ActionInfo::SetSystemIndicatorInfo(extension, action_info.release()); 43 ActionInfo::SetSystemIndicatorInfo(extension, action_info.release());
44 return true; 44 return true;
45 } 45 }
46 46
47 const std::vector<std::string> SystemIndicatorHandler::Keys() const { 47 const std::vector<std::string> SystemIndicatorHandler::Keys() const {
48 return SingleKey(manifest_keys::kSystemIndicator); 48 return SingleKey(manifest_keys::kSystemIndicator);
49 } 49 }
50 50
51 } // namespace extensions 51 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698