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

Side by Side Diff: chrome/common/extensions/api/omnibox/omnibox_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/omnibox/omnibox_handler.h" 5 #include "chrome/common/extensions/api/omnibox/omnibox_handler.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/extensions/api/commands/commands_handler.h" 11 #include "chrome/common/extensions/api/commands/commands_handler.h"
12 #include "chrome/common/extensions/api/extension_action/action_info.h" 12 #include "chrome/common/extensions/api/extension_action/action_info.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_manifest_constants.h" 14 #include "chrome/common/extensions/extension_manifest_constants.h"
15 #include "chrome/common/extensions/manifest.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 namespace { 19 namespace {
19 20
20 // Manifest keys. 21 // Manifest keys.
21 const char kKeyword[] = "keyword"; 22 const char kKeyword[] = "keyword";
22 23
23 } // namespace 24 } // namespace
24 25
(...skipping 12 matching lines...) Expand all
37 (CommandsInfo::GetPageActionCommand(extension) || 38 (CommandsInfo::GetPageActionCommand(extension) ||
38 !extension->page_action_info()->default_icon.empty())); 39 !extension->page_action_info()->default_icon.empty()));
39 } 40 }
40 41
41 OmniboxHandler::OmniboxHandler() { 42 OmniboxHandler::OmniboxHandler() {
42 } 43 }
43 44
44 OmniboxHandler::~OmniboxHandler() { 45 OmniboxHandler::~OmniboxHandler() {
45 } 46 }
46 47
47 bool OmniboxHandler::Parse(const base::Value* value, 48 bool OmniboxHandler::Parse(Extension* extension, string16* error) {
48 Extension* extension,
49 string16* error) {
50 scoped_ptr<OmniboxInfo> info(new OmniboxInfo); 49 scoped_ptr<OmniboxInfo> info(new OmniboxInfo);
51 const DictionaryValue* dict = NULL; 50 const DictionaryValue* dict = NULL;
52 if (!value->GetAsDictionary(&dict) || 51 if (!extension->manifest()->GetDictionary(extension_manifest_keys::kOmnibox,
52 &dict) ||
53 !dict->GetString(kKeyword, &info->keyword) || 53 !dict->GetString(kKeyword, &info->keyword) ||
54 info->keyword.empty()) { 54 info->keyword.empty()) {
55 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidOmniboxKeyword); 55 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidOmniboxKeyword);
56 return false; 56 return false;
57 } 57 }
58 extension->SetManifestData(extension_manifest_keys::kOmnibox, info.release()); 58 extension->SetManifestData(extension_manifest_keys::kOmnibox, info.release());
59 return true; 59 return true;
60 } 60 }
61 61
62 } // namespace extensions 62 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698