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

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 271117: Limit extensions to 1 UI surface (either Page/Browser action, but not both).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 951
952 page_action_.reset( 952 page_action_.reset(
953 LoadExtensionActionHelper(page_action_value, error, 953 LoadExtensionActionHelper(page_action_value, error,
954 ExtensionAction::PAGE_ACTION)); 954 ExtensionAction::PAGE_ACTION));
955 if (!page_action_.get()) 955 if (!page_action_.get())
956 return false; // Failed to parse page action definition. 956 return false; // Failed to parse page action definition.
957 } 957 }
958 958
959 // Initialize browser action (optional). 959 // Initialize browser action (optional).
960 if (source.HasKey(keys::kBrowserAction)) { 960 if (source.HasKey(keys::kBrowserAction)) {
961 // Restrict extensions to one UI surface.
962 if (source.HasKey(keys::kPageAction) || source.HasKey(keys::kPageActions)) {
963 *error = errors::kOneUISurfaceOnly;
964 return false;
965 }
966
961 DictionaryValue* browser_action_value; 967 DictionaryValue* browser_action_value;
962 if (!source.GetDictionary(keys::kBrowserAction, &browser_action_value)) { 968 if (!source.GetDictionary(keys::kBrowserAction, &browser_action_value)) {
963 *error = errors::kInvalidBrowserAction; 969 *error = errors::kInvalidBrowserAction;
964 return false; 970 return false;
965 } 971 }
966 972
967 browser_action_.reset( 973 browser_action_.reset(
968 LoadExtensionActionHelper(browser_action_value, error, 974 LoadExtensionActionHelper(browser_action_value, error,
969 ExtensionAction::BROWSER_ACTION)); 975 ExtensionAction::BROWSER_ACTION));
970 if (!browser_action_.get()) 976 if (!browser_action_.get())
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 UserScript::PatternList::const_iterator pattern = 1164 UserScript::PatternList::const_iterator pattern =
1159 content_script->url_patterns().begin(); 1165 content_script->url_patterns().begin();
1160 for (; pattern != content_script->url_patterns().end(); ++pattern) { 1166 for (; pattern != content_script->url_patterns().end(); ++pattern) {
1161 if (pattern->match_subdomains() && pattern->host().empty()) 1167 if (pattern->match_subdomains() && pattern->host().empty())
1162 return true; 1168 return true;
1163 } 1169 }
1164 } 1170 }
1165 1171
1166 return false; 1172 return false;
1167 } 1173 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698