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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.cc

Issue 12207104: Refactor app_list_util.h into AppListService abstract base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stray newline Created 7 years, 10 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
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/api/webstore_private/webstore_private_api.h" 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
6 6
7 #include "apps/app_launcher.h" 7 #include "apps/app_launcher.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/about_flags.h" 16 #include "chrome/browser/about_flags.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/extensions/crx_installer.h" 18 #include "chrome/browser/extensions/crx_installer.h"
19 #include "chrome/browser/extensions/extension_function_dispatcher.h" 19 #include "chrome/browser/extensions/extension_function_dispatcher.h"
20 #include "chrome/browser/extensions/extension_prefs.h" 20 #include "chrome/browser/extensions/extension_prefs.h"
21 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
22 #include "chrome/browser/extensions/extension_system.h" 22 #include "chrome/browser/extensions/extension_system.h"
23 #include "chrome/browser/extensions/webstore_installer.h" 23 #include "chrome/browser/extensions/webstore_installer.h"
24 #include "chrome/browser/gpu/gpu_feature_checker.h" 24 #include "chrome/browser/gpu/gpu_feature_checker.h"
25 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/browser/signin/token_service.h" 26 #include "chrome/browser/signin/token_service.h"
27 #include "chrome/browser/signin/token_service_factory.h" 27 #include "chrome/browser/signin/token_service_factory.h"
28 #include "chrome/browser/sync/profile_sync_service.h" 28 #include "chrome/browser/sync/profile_sync_service.h"
29 #include "chrome/browser/sync/profile_sync_service_factory.h" 29 #include "chrome/browser/sync/profile_sync_service_factory.h"
30 #include "chrome/browser/ui/app_list/app_list_util.h" 30 #include "chrome/browser/ui/app_list/app_list_service.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/extensions/extension_constants.h" 33 #include "chrome/common/extensions/extension_constants.h"
34 #include "chrome/common/extensions/extension_l10n_util.h" 34 #include "chrome/common/extensions/extension_l10n_util.h"
35 #include "chrome/common/extensions/extension_manifest_constants.h" 35 #include "chrome/common/extensions/extension_manifest_constants.h"
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "content/public/browser/gpu_data_manager.h" 37 #include "content/public/browser/gpu_data_manager.h"
38 #include "content/public/browser/notification_details.h" 38 #include "content/public/browser/notification_details.h"
39 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 apps::GetIsAppLauncherEnabled(base::Bind( 465 apps::GetIsAppLauncherEnabled(base::Bind(
466 &CompleteInstallFunction::OnGetAppLauncherEnabled, this, 466 &CompleteInstallFunction::OnGetAppLauncherEnabled, this,
467 approval_->extension_id)); 467 approval_->extension_id));
468 } 468 }
469 469
470 void CompleteInstallFunction::OnGetAppLauncherEnabled( 470 void CompleteInstallFunction::OnGetAppLauncherEnabled(
471 std::string id, 471 std::string id,
472 bool app_launcher_enabled) { 472 bool app_launcher_enabled) {
473 if (app_launcher_enabled) { 473 if (app_launcher_enabled) {
474 std::string name; 474 std::string name;
475 #if defined(ENABLE_APP_LIST)
476 if (!approval_->parsed_manifest->GetString(extension_manifest_keys::kName, 475 if (!approval_->parsed_manifest->GetString(extension_manifest_keys::kName,
477 &name)) { 476 &name)) {
478 NOTREACHED(); 477 NOTREACHED();
479 } 478 }
480 // Tell the app list about the install that we just started. 479 // Tell the app list about the install that we just started.
481 chrome::NotifyAppListOfBeginExtensionInstall( 480 AppListService::Get()->OnBeginExtensionInstall(
482 profile(), id, name, approval_->installing_icon); 481 profile(), id, name, approval_->installing_icon);
483 #endif
484 } 482 }
485 483
486 // The extension will install through the normal extension install flow, but 484 // The extension will install through the normal extension install flow, but
487 // the whitelist entry will bypass the normal permissions install dialog. 485 // the whitelist entry will bypass the normal permissions install dialog.
488 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( 486 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
489 profile(), this, 487 profile(), this,
490 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()), 488 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()),
491 id, approval_.Pass(), WebstoreInstaller::FLAG_NONE); 489 id, approval_.Pass(), WebstoreInstaller::FLAG_NONE);
492 installer->Start(); 490 installer->Start();
493 } 491 }
494 492
495 void CompleteInstallFunction::OnExtensionInstallSuccess( 493 void CompleteInstallFunction::OnExtensionInstallSuccess(
496 const std::string& id) { 494 const std::string& id) {
497 if (test_webstore_installer_delegate) 495 if (test_webstore_installer_delegate)
498 test_webstore_installer_delegate->OnExtensionInstallSuccess(id); 496 test_webstore_installer_delegate->OnExtensionInstallSuccess(id);
499 497
500 SendResponse(true); 498 SendResponse(true);
501 499
502 // Matches the AddRef in RunImpl(). 500 // Matches the AddRef in RunImpl().
503 Release(); 501 Release();
504 } 502 }
505 503
506 void CompleteInstallFunction::OnExtensionInstallFailure( 504 void CompleteInstallFunction::OnExtensionInstallFailure(
507 const std::string& id, 505 const std::string& id,
508 const std::string& error, 506 const std::string& error,
509 WebstoreInstaller::FailureReason reason) { 507 WebstoreInstaller::FailureReason reason) {
510 #if defined(ENABLE_APP_LIST) 508 AppListService::Get()->OnExtensionInstallFailure(profile(), id);
511 chrome::NotifyAppListOfExtensionInstallFailure(profile(), id);
512 #endif
513 if (test_webstore_installer_delegate) { 509 if (test_webstore_installer_delegate) {
514 test_webstore_installer_delegate->OnExtensionInstallFailure( 510 test_webstore_installer_delegate->OnExtensionInstallFailure(
515 id, error, reason); 511 id, error, reason);
516 } 512 }
517 513
518 error_ = error; 514 error_ = error;
519 SendResponse(false); 515 SendResponse(false);
520 516
521 // Matches the AddRef in RunImpl(). 517 // Matches the AddRef in RunImpl().
522 Release(); 518 Release();
523 } 519 }
524 520
525 void CompleteInstallFunction::OnExtensionDownloadProgress( 521 void CompleteInstallFunction::OnExtensionDownloadProgress(
526 const std::string& id, 522 const std::string& id,
527 content::DownloadItem* item) { 523 content::DownloadItem* item) {
528 #if defined(ENABLE_APP_LIST) 524 AppListService::Get()->OnDownloadProgress(
529 chrome::NotifyAppListOfDownloadProgress(profile(), id, 525 profile(), id, item->PercentComplete());
530 item->PercentComplete());
531 #endif
532 } 526 }
533 527
534 bool GetBrowserLoginFunction::RunImpl() { 528 bool GetBrowserLoginFunction::RunImpl() {
535 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); 529 SetResult(CreateLoginResult(profile_->GetOriginalProfile()));
536 return true; 530 return true;
537 } 531 }
538 532
539 bool GetStoreLoginFunction::RunImpl() { 533 bool GetStoreLoginFunction::RunImpl() {
540 ExtensionService* service = 534 ExtensionService* service =
541 extensions::ExtensionSystem::Get(profile_)->extension_service(); 535 extensions::ExtensionSystem::Get(profile_)->extension_service();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); 582 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this));
589 return true; 583 return true;
590 } 584 }
591 585
592 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { 586 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) {
593 SetResult(Value::CreateBooleanValue(is_enabled)); 587 SetResult(Value::CreateBooleanValue(is_enabled));
594 SendResponse(true); 588 SendResponse(true);
595 } 589 }
596 590
597 } // namespace extensions 591 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698