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

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 16283002: Move Extension::UpdatesFromGallery to ManifestURL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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/browser/extensions/extension_service.cc » ('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) 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/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/web_applications/web_app.h" 34 #include "chrome/browser/web_applications/web_app.h"
35 #include "chrome/common/chrome_notification_types.h" 35 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/chrome_paths.h" 36 #include "chrome/common/chrome_paths.h"
37 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
38 #include "chrome/common/extensions/extension_file_util.h" 38 #include "chrome/common/extensions/extension_file_util.h"
39 #include "chrome/common/extensions/extension_icon_set.h" 39 #include "chrome/common/extensions/extension_icon_set.h"
40 #include "chrome/common/extensions/feature_switch.h" 40 #include "chrome/common/extensions/feature_switch.h"
41 #include "chrome/common/extensions/manifest.h" 41 #include "chrome/common/extensions/manifest.h"
42 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" 42 #include "chrome/common/extensions/manifest_handlers/icons_handler.h"
43 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" 43 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h"
44 #include "chrome/common/extensions/manifest_url_handler.h"
44 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
45 #include "content/public/browser/notification_service.h" 46 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/resource_dispatcher_host.h" 47 #include "content/public/browser/resource_dispatcher_host.h"
47 #include "content/public/browser/user_metrics.h" 48 #include "content/public/browser/user_metrics.h"
48 #include "grit/chromium_strings.h" 49 #include "grit/chromium_strings.h"
49 #include "grit/generated_resources.h" 50 #include "grit/generated_resources.h"
50 #include "grit/theme_resources.h" 51 #include "grit/theme_resources.h"
51 #include "third_party/skia/include/core/SkBitmap.h" 52 #include "third_party/skia/include/core/SkBitmap.h"
52 #include "ui/base/l10n/l10n_util.h" 53 #include "ui/base/l10n/l10n_util.h"
53 #include "ui/base/resource/resource_bundle.h" 54 #include "ui/base/resource/resource_bundle.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 ASCIIToUTF16(Extension::kMimeType))); 303 ASCIIToUTF16(Extension::kMimeType)));
303 } 304 }
304 305
305 // If the client_ is NULL, then the app is either being installed via 306 // If the client_ is NULL, then the app is either being installed via
306 // an internal mechanism like sync, external_extensions, or default apps. 307 // an internal mechanism like sync, external_extensions, or default apps.
307 // In that case, we don't want to enforce things like the install origin. 308 // In that case, we don't want to enforce things like the install origin.
308 if (!is_gallery_install() && client_) { 309 if (!is_gallery_install() && client_) {
309 // For apps with a gallery update URL, require that they be installed 310 // For apps with a gallery update URL, require that they be installed
310 // from the gallery. 311 // from the gallery.
311 // TODO(erikkay) Apply this rule for paid extensions and themes as well. 312 // TODO(erikkay) Apply this rule for paid extensions and themes as well.
312 if (extension->UpdatesFromGallery()) { 313 if (ManifestURL::UpdatesFromGallery(extension)) {
313 return CrxInstallerError( 314 return CrxInstallerError(
314 l10n_util::GetStringFUTF16( 315 l10n_util::GetStringFUTF16(
315 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS, 316 IDS_EXTENSION_DISALLOW_NON_DOWNLOADED_GALLERY_INSTALLS,
316 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); 317 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)));
317 } 318 }
318 319
319 // For self-hosted apps, verify that the entire extent is on the same 320 // For self-hosted apps, verify that the entire extent is on the same
320 // host (or a subdomain of the host) the download happened from. There's 321 // host (or a subdomain of the host) the download happened from. There's
321 // no way for us to verify that the app controls any other hosts. 322 // no way for us to verify that the app controls any other hosts.
322 URLPattern pattern(UserScript::ValidUserScriptSchemes()); 323 URLPattern pattern(UserScript::ValidUserScriptSchemes());
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) 789 if (!prefs->DidExtensionEscalatePermissions(extension()->id()))
789 return; 790 return;
790 791
791 if (client_) { 792 if (client_) {
792 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). 793 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort().
793 client_->ConfirmReEnable(this, extension()); 794 client_->ConfirmReEnable(this, extension());
794 } 795 }
795 } 796 }
796 797
797 } // namespace extensions 798 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698