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

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

Issue 308003005: app_list: Drive app integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pref is_syancable -> do_not_sync, remove AppListModel deps and no auto uninstall new_app Created 6 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
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/installed_loader.h" 5 #include "chrome/browser/extensions/installed_loader.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 extension_registry_(ExtensionRegistry::Get(extension_service->profile())), 141 extension_registry_(ExtensionRegistry::Get(extension_service->profile())),
142 extension_prefs_(ExtensionPrefs::Get(extension_service->profile())) {} 142 extension_prefs_(ExtensionPrefs::Get(extension_service->profile())) {}
143 143
144 InstalledLoader::~InstalledLoader() { 144 InstalledLoader::~InstalledLoader() {
145 } 145 }
146 146
147 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { 147 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
148 std::string error; 148 std::string error;
149 scoped_refptr<const Extension> extension(NULL); 149 scoped_refptr<const Extension> extension(NULL);
150 if (info.extension_manifest) { 150 if (info.extension_manifest) {
151 extension = Extension::Create( 151 scoped_refptr<Extension> mutable_extension = Extension::Create(
152 info.extension_path, 152 info.extension_path,
153 info.extension_location, 153 info.extension_location,
154 *info.extension_manifest, 154 *info.extension_manifest,
155 GetCreationFlags(&info), 155 GetCreationFlags(&info),
156 &error); 156 &error);
157 if (mutable_extension) {
158 mutable_extension->set_is_syncable(
159 extension_prefs_->IsSyncable(mutable_extension->id()));
160 extension = mutable_extension;
161 }
157 } else { 162 } else {
158 error = errors::kManifestUnreadable; 163 error = errors::kManifestUnreadable;
159 } 164 }
160 165
161 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by 166 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by
162 // updating the 'key' field in their manifest). 167 // updating the 'key' field in their manifest).
163 // TODO(jstritar): migrate preferences when unpacked extensions change IDs. 168 // TODO(jstritar): migrate preferences when unpacked extensions change IDs.
164 if (extension.get() && !Manifest::IsUnpackedLocation(extension->location()) && 169 if (extension.get() && !Manifest::IsUnpackedLocation(extension->location()) &&
165 info.extension_id != extension->id()) { 170 info.extension_id != extension->id()) {
166 error = errors::kCannotChangeExtensionID; 171 error = errors::kCannotChangeExtensionID;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { 552 int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
548 int flags = extension_prefs_->GetCreationFlags(info->extension_id); 553 int flags = extension_prefs_->GetCreationFlags(info->extension_id);
549 if (!Manifest::IsUnpackedLocation(info->extension_location)) 554 if (!Manifest::IsUnpackedLocation(info->extension_location))
550 flags |= Extension::REQUIRE_KEY; 555 flags |= Extension::REQUIRE_KEY;
551 if (extension_prefs_->AllowFileAccess(info->extension_id)) 556 if (extension_prefs_->AllowFileAccess(info->extension_id))
552 flags |= Extension::ALLOW_FILE_ACCESS; 557 flags |= Extension::ALLOW_FILE_ACCESS;
553 return flags; 558 return flags;
554 } 559 }
555 560
556 } // namespace extensions 561 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698