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

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

Issue 8800016: Exempt default apps from external-extension alerts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Suggestions from Roger. Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/external_extension_provider_impl.h" 5 #include "chrome/browser/extensions/external_extension_provider_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ExternalExtensionLoader* loader, 49 ExternalExtensionLoader* loader,
50 Extension::Location crx_location, 50 Extension::Location crx_location,
51 Extension::Location download_location, 51 Extension::Location download_location,
52 int creation_flags) 52 int creation_flags)
53 : crx_location_(crx_location), 53 : crx_location_(crx_location),
54 download_location_(download_location), 54 download_location_(download_location),
55 service_(service), 55 service_(service),
56 prefs_(NULL), 56 prefs_(NULL),
57 ready_(false), 57 ready_(false),
58 loader_(loader), 58 loader_(loader),
59 creation_flags_(creation_flags) { 59 creation_flags_(creation_flags),
60 auto_acknowledge_(false) {
60 loader_->Init(this); 61 loader_->Init(this);
61 } 62 }
62 63
63 ExternalExtensionProviderImpl::~ExternalExtensionProviderImpl() { 64 ExternalExtensionProviderImpl::~ExternalExtensionProviderImpl() {
64 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 65 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
65 loader_->OwnerShutdown(); 66 loader_->OwnerShutdown();
66 } 67 }
67 68
68 void ExternalExtensionProviderImpl::VisitRegisteredExtension() { 69 void ExternalExtensionProviderImpl::VisitRegisteredExtension() {
69 // The loader will call back to SetPrefs. 70 // The loader will call back to SetPrefs.
70 loader_->StartLoading(); 71 loader_->StartLoading();
71 } 72 }
72 73
73 void ExternalExtensionProviderImpl::SetPrefs(DictionaryValue* prefs) { 74 void ExternalExtensionProviderImpl::SetPrefs(DictionaryValue* prefs) {
74 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
75 76
76 // Check if the service is still alive. It is possible that it had went 77 // Check if the service is still alive. It is possible that it went
77 // away while |loader_| was working on the FILE thread. 78 // away while |loader_| was working on the FILE thread.
78 if (!service_) return; 79 if (!service_) return;
79 80
80 prefs_.reset(prefs); 81 prefs_.reset(prefs);
81 ready_ = true; // Queries for extensions are allowed from this point. 82 ready_ = true; // Queries for extensions are allowed from this point.
82 83
83 // Set of unsupported extensions that need to be deleted from prefs_. 84 // Set of unsupported extensions that need to be deleted from prefs_.
84 std::set<std::string> unsupported_extensions; 85 std::set<std::string> unsupported_extensions;
85 86
86 // Notify ExtensionService about all the extensions this provider has. 87 // Notify ExtensionService about all the extensions this provider has.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 scoped_ptr<Version> version; 191 scoped_ptr<Version> version;
191 version.reset(Version::GetVersionFromString(external_version)); 192 version.reset(Version::GetVersionFromString(external_version));
192 if (!version.get()) { 193 if (!version.get()) {
193 LOG(WARNING) << "Malformed extension dictionary for extension: " 194 LOG(WARNING) << "Malformed extension dictionary for extension: "
194 << extension_id.c_str() << ". Invalid version string \"" 195 << extension_id.c_str() << ". Invalid version string \""
195 << external_version << "\"."; 196 << external_version << "\".";
196 continue; 197 continue;
197 } 198 }
198 service_->OnExternalExtensionFileFound(extension_id, version.get(), path, 199 service_->OnExternalExtensionFileFound(extension_id, version.get(), path,
199 crx_location_, creation_flags_); 200 crx_location_, creation_flags_,
201 auto_acknowledge_);
200 } else { // if (has_external_update_url) 202 } else { // if (has_external_update_url)
201 CHECK(has_external_update_url); // Checking of keys above ensures this. 203 CHECK(has_external_update_url); // Checking of keys above ensures this.
202 if (download_location_ == Extension::INVALID) { 204 if (download_location_ == Extension::INVALID) {
203 LOG(WARNING) << "This provider does not support installing external " 205 LOG(WARNING) << "This provider does not support installing external "
204 << "extensions from update URLs."; 206 << "extensions from update URLs.";
205 continue; 207 continue;
206 } 208 }
207 GURL update_url(external_update_url); 209 GURL update_url(external_update_url);
208 if (!update_url.is_valid()) { 210 if (!update_url.is_valid()) {
209 LOG(WARNING) << "Malformed extension dictionary for extension: " 211 LOG(WARNING) << "Malformed extension dictionary for extension: "
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 profile, 362 profile,
361 service, 363 service,
362 new ExternalPrefExtensionLoader( 364 new ExternalPrefExtensionLoader(
363 chrome::DIR_DEFAULT_APPS, 365 chrome::DIR_DEFAULT_APPS,
364 ExternalPrefExtensionLoader::NONE), 366 ExternalPrefExtensionLoader::NONE),
365 Extension::EXTERNAL_PREF, 367 Extension::EXTERNAL_PREF,
366 Extension::INVALID, 368 Extension::INVALID,
367 Extension::FROM_BOOKMARK))); 369 Extension::FROM_BOOKMARK)));
368 #endif 370 #endif
369 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698