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

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

Issue 12084034: Change manifest handler interface to always (implicitly) pass the entire manifest to handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tts, TODO Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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/common/extensions/api/extension_action/browser_action_handler.h " 5 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h "
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/extension_constants.h" 11 #include "chrome/common/extensions/extension_constants.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h" 12 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/feature_switch.h" 13 #include "chrome/common/extensions/feature_switch.h"
14 #include "chrome/common/extensions/manifest.h"
14 #include "chrome/common/extensions/manifest_handler_helpers.h" 15 #include "chrome/common/extensions/manifest_handler_helpers.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 BrowserActionHandler::BrowserActionHandler() { 19 BrowserActionHandler::BrowserActionHandler() {
19 } 20 }
20 21
21 BrowserActionHandler::~BrowserActionHandler() { 22 BrowserActionHandler::~BrowserActionHandler() {
22 } 23 }
23 24
24 bool BrowserActionHandler::Parse(const base::Value* value, 25 bool BrowserActionHandler::Parse(Extension* extension,
25 Extension* extension,
26 string16* error) { 26 string16* error) {
27 const DictionaryValue* dict = NULL; 27 const DictionaryValue* dict = NULL;
28 if (!value->GetAsDictionary(&dict)) { 28 if (!extension->manifest()->GetDictionary(
29 extension_manifest_keys::kBrowserAction, &dict)) {
29 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidBrowserAction); 30 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidBrowserAction);
30 return false; 31 return false;
31 } 32 }
32 33
33 scoped_ptr<ActionInfo> action_info = 34 scoped_ptr<ActionInfo> action_info =
34 manifest_handler_helpers::LoadActionInfo(extension, dict, error); 35 manifest_handler_helpers::LoadActionInfo(extension, dict, error);
35 if (!action_info.get()) 36 if (!action_info.get())
36 return false; // Failed to parse browser action definition. 37 return false; // Failed to parse browser action definition.
37 38
38 ActionInfo::SetBrowserActionInfo(extension, action_info.release()); 39 ActionInfo::SetBrowserActionInfo(extension, action_info.release());
39 40
40 return true; 41 return true;
41 } 42 }
42 43
43 } // namespace extensions 44 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698