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

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

Issue 919733002: [Extensions Toolbar] Have all extensions in the toolbar show a context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 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 "extensions/common/extension.h" 5 #include "extensions/common/extension.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "base/version.h" 22 #include "base/version.h"
23 #include "components/crx_file/id_util.h" 23 #include "components/crx_file/id_util.h"
24 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
25 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
26 #include "extensions/common/error_utils.h" 26 #include "extensions/common/error_utils.h"
27 #include "extensions/common/feature_switch.h"
27 #include "extensions/common/manifest.h" 28 #include "extensions/common/manifest.h"
28 #include "extensions/common/manifest_constants.h" 29 #include "extensions/common/manifest_constants.h"
29 #include "extensions/common/manifest_handler.h" 30 #include "extensions/common/manifest_handler.h"
30 #include "extensions/common/manifest_handlers/permissions_parser.h" 31 #include "extensions/common/manifest_handlers/permissions_parser.h"
31 #include "extensions/common/permissions/permission_set.h" 32 #include "extensions/common/permissions/permission_set.h"
32 #include "extensions/common/permissions/permissions_data.h" 33 #include "extensions/common/permissions/permissions_data.h"
33 #include "extensions/common/permissions/permissions_info.h" 34 #include "extensions/common/permissions/permissions_info.h"
34 #include "extensions/common/switches.h" 35 #include "extensions/common/switches.h"
35 #include "extensions/common/url_pattern.h" 36 #include "extensions/common/url_pattern.h"
36 #include "net/base/filename_util.h" 37 #include "net/base/filename_util.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { 269 GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) {
269 return GURL(std::string(extensions::kExtensionScheme) + 270 return GURL(std::string(extensions::kExtensionScheme) +
270 url::kStandardSchemeSeparator + extension_id + "/"); 271 url::kStandardSchemeSeparator + extension_id + "/");
271 } 272 }
272 273
273 bool Extension::ShowConfigureContextMenus() const { 274 bool Extension::ShowConfigureContextMenus() const {
274 // Don't show context menu for component extensions. We might want to show 275 // Don't show context menu for component extensions. We might want to show
275 // options for component extension button but now there is no component 276 // options for component extension button but now there is no component
276 // extension with options. All other menu items like uninstall have 277 // extension with options. All other menu items like uninstall have
277 // no sense for component extensions. 278 // no sense for component extensions.
279 // We change this rule if the redesign is enabled, because it's just weird to
280 // have a random button that has no context menu when the rest do.
278 return location() != Manifest::COMPONENT && 281 return location() != Manifest::COMPONENT &&
279 location() != Manifest::EXTERNAL_COMPONENT; 282 location() != Manifest::EXTERNAL_COMPONENT &&
283 !FeatureSwitch::extension_action_redesign()->IsEnabled();
Finnur 2015/02/13 14:49:59 But what does the menu show for component extensio
Devlin 2015/02/13 18:06:54 Good questions, all! So, first off, the only comp
Finnur 2015/02/16 11:39:51 I'd be surprised if they are different, but in any
Finnur 2015/02/16 11:39:51 Hah! I made the same mistake you did when I review
Devlin 2015/02/17 18:40:41 Yes, that is more readable. :) Done.
280 } 284 }
281 285
282 bool Extension::OverlapsWithOrigin(const GURL& origin) const { 286 bool Extension::OverlapsWithOrigin(const GURL& origin) const {
283 if (url() == origin) 287 if (url() == origin)
284 return true; 288 return true;
285 289
286 if (web_extent().is_empty()) 290 if (web_extent().is_empty())
287 return false; 291 return false;
288 292
289 // Note: patterns and extents ignore port numbers. 293 // Note: patterns and extents ignore port numbers.
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 779
776 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 780 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
777 const Extension* extension, 781 const Extension* extension,
778 const PermissionSet* permissions, 782 const PermissionSet* permissions,
779 Reason reason) 783 Reason reason)
780 : reason(reason), 784 : reason(reason),
781 extension(extension), 785 extension(extension),
782 permissions(permissions) {} 786 permissions(permissions) {}
783 787
784 } // namespace extensions 788 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698