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

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

Issue 1168383002: Implement sidebar support for extension action popups Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix assertion failure at extension_view_host.cc Created 5 years, 2 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) 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/action_info.h" 5 #include "chrome/common/extensions/api/extension_action/action_info.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 "chrome/common/extensions/api/commands/commands_handler.h" 9 #include "chrome/common/extensions/api/commands/commands_handler.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 27 matching lines...) Expand all
38 38
39 static const ActionInfo* GetActionInfo(const Extension* extension, 39 static const ActionInfo* GetActionInfo(const Extension* extension,
40 const std::string& key) { 40 const std::string& key) {
41 ActionInfoData* data = static_cast<ActionInfoData*>( 41 ActionInfoData* data = static_cast<ActionInfoData*>(
42 extension->GetManifestData(key)); 42 extension->GetManifestData(key));
43 return data ? data->action_info.get() : NULL; 43 return data ? data->action_info.get() : NULL;
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 ActionInfo::ActionInfo() { 48 ActionInfo::ActionInfo() : open_in_sidebar(false) {}
49 }
50 49
51 ActionInfo::~ActionInfo() { 50 ActionInfo::~ActionInfo() {
52 } 51 }
53 52
54 // static 53 // static
55 scoped_ptr<ActionInfo> ActionInfo::Load(const Extension* extension, 54 scoped_ptr<ActionInfo> ActionInfo::Load(const Extension* extension,
56 const base::DictionaryValue* dict, 55 const base::DictionaryValue* dict,
57 base::string16* error) { 56 base::string16* error) {
58 scoped_ptr<ActionInfo> result(new ActionInfo()); 57 scoped_ptr<ActionInfo> result(new ActionInfo());
59 58
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 *error = ErrorUtils::FormatErrorMessageUTF16( 174 *error = ErrorUtils::FormatErrorMessageUTF16(
176 errors::kInvalidPageActionPopupPath, url_str); 175 errors::kInvalidPageActionPopupPath, url_str);
177 return scoped_ptr<ActionInfo>(); 176 return scoped_ptr<ActionInfo>();
178 } 177 }
179 } else { 178 } else {
180 DCHECK(result->default_popup_url.is_empty()) 179 DCHECK(result->default_popup_url.is_empty())
181 << "Shouldn't be possible for the popup to be set."; 180 << "Shouldn't be possible for the popup to be set.";
182 } 181 }
183 } 182 }
184 183
184 // Should open popup in sidebar?
185 dict->GetBoolean(keys::kPageActionOpenInSidebar, &result->open_in_sidebar);
186
185 return result.Pass(); 187 return result.Pass();
186 } 188 }
187 189
188 // static 190 // static
189 const ActionInfo* ActionInfo::GetBrowserActionInfo(const Extension* extension) { 191 const ActionInfo* ActionInfo::GetBrowserActionInfo(const Extension* extension) {
190 return GetActionInfo(extension, keys::kBrowserAction); 192 return GetActionInfo(extension, keys::kBrowserAction);
191 } 193 }
192 194
193 const ActionInfo* ActionInfo::GetPageActionInfo(const Extension* extension) { 195 const ActionInfo* ActionInfo::GetPageActionInfo(const Extension* extension) {
194 return GetActionInfo(extension, keys::kPageAction); 196 return GetActionInfo(extension, keys::kPageAction);
(...skipping 25 matching lines...) Expand all
220 222
221 // static 223 // static
222 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { 224 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) {
223 const ActionInfo* page_action_info = GetPageActionInfo(extension); 225 const ActionInfo* page_action_info = GetPageActionInfo(extension);
224 return page_action_info && 226 return page_action_info &&
225 (CommandsInfo::GetPageActionCommand(extension) || 227 (CommandsInfo::GetPageActionCommand(extension) ||
226 !page_action_info->default_icon.empty()); 228 !page_action_info->default_icon.empty());
227 } 229 }
228 230
229 } // namespace extensions 231 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_action/action_info.h ('k') | chrome/test/data/extensions/sidebar/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698