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

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

Issue 8430033: Adds a webstorePrivate method for silently installing extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 std::set<std::string> ids; 49 std::set<std::string> ids;
50 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries; 50 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries;
51 }; 51 };
52 52
53 static base::LazyInstance<Whitelist> 53 static base::LazyInstance<Whitelist>
54 g_whitelisted_install_data(base::LINKER_INITIALIZED); 54 g_whitelisted_install_data(base::LINKER_INITIALIZED);
55 55
56 } // namespace 56 } // namespace
57 57
58 CrxInstaller::WhitelistEntry::WhitelistEntry() 58 CrxInstaller::WhitelistEntry::WhitelistEntry()
59 : use_app_installed_bubble(false) {} 59 : use_app_installed_bubble(false),
60 skip_post_install_ui(false) {}
60 CrxInstaller::WhitelistEntry::~WhitelistEntry() {} 61 CrxInstaller::WhitelistEntry::~WhitelistEntry() {}
61 62
62 // static 63 // static
63 void CrxInstaller::SetWhitelistedInstallId(const std::string& id) { 64 void CrxInstaller::SetWhitelistedInstallId(const std::string& id) {
64 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 65 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
65 g_whitelisted_install_data.Get().ids.insert(id); 66 g_whitelisted_install_data.Get().ids.insert(id);
66 } 67 }
67 68
68 // static 69 // static
69 void CrxInstaller::SetWhitelistEntry(const std::string& id, 70 void CrxInstaller::SetWhitelistEntry(const std::string& id,
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 RemoveWhitelistEntry(extension_->id())); 408 RemoveWhitelistEntry(extension_->id()));
408 if (is_gallery_install() && entry.get() && original_manifest_.get()) { 409 if (is_gallery_install() && entry.get() && original_manifest_.get()) {
409 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) { 410 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) {
410 ReportFailureFromUIThread( 411 ReportFailureFromUIThread(
411 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID)); 412 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID));
412 return; 413 return;
413 } 414 }
414 whitelisted = true; 415 whitelisted = true;
415 if (entry->use_app_installed_bubble) 416 if (entry->use_app_installed_bubble)
416 client_->set_use_app_installed_bubble(true); 417 client_->set_use_app_installed_bubble(true);
418 if (entry->skip_post_install_ui)
419 client_->set_skip_post_install_ui(true);
417 } 420 }
418 421
419 if (client_ && 422 if (client_ &&
420 (!allow_silent_install_ || !whitelisted)) { 423 (!allow_silent_install_ || !whitelisted)) {
421 AddRef(); // Balanced in Proceed() and Abort(). 424 AddRef(); // Balanced in Proceed() and Abort().
422 client_->ConfirmInstall(this, extension_.get()); 425 client_->ConfirmInstall(this, extension_.get());
423 } else { 426 } else {
424 if (!BrowserThread::PostTask( 427 if (!BrowserThread::PostTask(
425 BrowserThread::FILE, FROM_HERE, 428 BrowserThread::FILE, FROM_HERE,
426 base::Bind(&CrxInstaller::CompleteInstall, this))) 429 base::Bind(&CrxInstaller::CompleteInstall, this)))
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 // Some users (such as the download shelf) need to know when a 596 // Some users (such as the download shelf) need to know when a
594 // CRXInstaller is done. Listening for the EXTENSION_* events 597 // CRXInstaller is done. Listening for the EXTENSION_* events
595 // is problematic because they don't know anything about the 598 // is problematic because they don't know anything about the
596 // extension before it is unpacked, so they can not filter based 599 // extension before it is unpacked, so they can not filter based
597 // on the extension. 600 // on the extension.
598 content::NotificationService::current()->Notify( 601 content::NotificationService::current()->Notify(
599 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 602 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
600 content::Source<CrxInstaller>(this), 603 content::Source<CrxInstaller>(this),
601 content::NotificationService::NoDetails()); 604 content::NotificationService::NoDetails());
602 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698