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

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

Issue 10010038: Do not show the install prompt for themes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/extension_webstore_private_api.h" 5 #include "chrome/browser/extensions/extension_webstore_private_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 Release(); // Balanced in RunImpl(). 242 Release(); // Balanced in RunImpl().
243 } 243 }
244 244
245 void InstallBundleFunction::OnBundleInstallCompleted() { 245 void InstallBundleFunction::OnBundleInstallCompleted() {
246 SendResponse(true); 246 SendResponse(true);
247 247
248 Release(); // Balanced in RunImpl(). 248 Release(); // Balanced in RunImpl().
249 } 249 }
250 250
251 BeginInstallWithManifestFunction::BeginInstallWithManifestFunction() 251 BeginInstallWithManifestFunction::BeginInstallWithManifestFunction()
252 : use_app_installed_bubble_(false) {} 252 : use_app_installed_bubble_(false) {}
253 253
254 BeginInstallWithManifestFunction::~BeginInstallWithManifestFunction() {} 254 BeginInstallWithManifestFunction::~BeginInstallWithManifestFunction() {}
255 255
256 bool BeginInstallWithManifestFunction::RunImpl() { 256 bool BeginInstallWithManifestFunction::RunImpl() {
257 DictionaryValue* details = NULL; 257 DictionaryValue* details = NULL;
258 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); 258 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
259 CHECK(details); 259 CHECK(details);
260 260
261 EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_)); 261 EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_));
262 if (!Extension::IdIsValid(id_)) { 262 if (!Extension::IdIsValid(id_)) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 void BeginInstallWithManifestFunction::OnWebstoreParseSuccess( 350 void BeginInstallWithManifestFunction::OnWebstoreParseSuccess(
351 const std::string& id, 351 const std::string& id,
352 const SkBitmap& icon, 352 const SkBitmap& icon,
353 DictionaryValue* parsed_manifest) { 353 DictionaryValue* parsed_manifest) {
354 CHECK_EQ(id_, id); 354 CHECK_EQ(id_, id);
355 CHECK(parsed_manifest); 355 CHECK(parsed_manifest);
356 icon_ = icon; 356 icon_ = icon;
357 parsed_manifest_.reset(parsed_manifest); 357 parsed_manifest_.reset(parsed_manifest);
358 358
359 ExtensionInstallUI::Prompt prompt(ExtensionInstallUI::INSTALL_PROMPT); 359 std::string error;
360 dummy_extension_ = ExtensionInstallUI::GetLocalizedExtensionForDisplay(
361 parsed_manifest_.get(), id, localized_name_, "", &error);
360 362
361 if (!ShowExtensionInstallDialogForManifest( 363 if (!dummy_extension_) {
362 profile(),
363 this,
364 parsed_manifest,
365 id_,
366 localized_name_,
367 "", // no localized description
368 &icon_,
369 prompt,
370 &dummy_extension_)) {
371 OnWebstoreParseFailure(id_, WebstoreInstallHelper::Delegate::MANIFEST_ERROR, 364 OnWebstoreParseFailure(id_, WebstoreInstallHelper::Delegate::MANIFEST_ERROR,
372 kInvalidManifestError); 365 kInvalidManifestError);
373 return; 366 return;
374 } 367 }
375 368
369 install_ui_.reset(new ExtensionInstallUI(profile()));
370 install_ui_->ConfirmWebstoreInstall(this, dummy_extension_, &icon_);
376 // Control flow finishes up in InstallUIProceed or InstallUIAbort. 371 // Control flow finishes up in InstallUIProceed or InstallUIAbort.
377 } 372 }
378 373
379 void BeginInstallWithManifestFunction::OnWebstoreParseFailure( 374 void BeginInstallWithManifestFunction::OnWebstoreParseFailure(
380 const std::string& id, 375 const std::string& id,
381 WebstoreInstallHelper::Delegate::InstallHelperResultCode result_code, 376 WebstoreInstallHelper::Delegate::InstallHelperResultCode result_code,
382 const std::string& error_message) { 377 const std::string& error_message) {
383 CHECK_EQ(id_, id); 378 CHECK_EQ(id_, id);
384 379
385 // Map from WebstoreInstallHelper's result codes to ours. 380 // Map from WebstoreInstallHelper's result codes to ours.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 SendResponse(true); 634 SendResponse(true);
640 } else { 635 } else {
641 // Matched with a Release in OnGpuInfoUpdate. 636 // Matched with a Release in OnGpuInfoUpdate.
642 AddRef(); 637 AddRef();
643 638
644 manager->AddObserver(this); 639 manager->AddObserver(this);
645 manager->RequestCompleteGpuInfoIfNeeded(); 640 manager->RequestCompleteGpuInfoIfNeeded();
646 } 641 }
647 return true; 642 return true;
648 } 643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698