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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 10873022: Revert 152904 - Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/ui/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_split.h" 17 #include "base/string_split.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chrome/browser/extensions/app_notification.h" 21 #include "chrome/browser/extensions/app_notification.h"
22 #include "chrome/browser/extensions/app_notification_manager.h" 22 #include "chrome/browser/extensions/app_notification_manager.h"
23 #include "chrome/browser/extensions/crx_installer.h" 23 #include "chrome/browser/extensions/crx_installer.h"
24 #include "chrome/browser/extensions/extension_prefs.h" 24 #include "chrome/browser/extensions/extension_prefs.h"
25 #include "chrome/browser/extensions/extension_service.h" 25 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/browser/extensions/extension_sorting.h" 26 #include "chrome/browser/extensions/extension_sorting.h"
27 #include "chrome/browser/extensions/extension_system.h" 27 #include "chrome/browser/extensions/extension_system.h"
28 #include "chrome/browser/favicon/favicon_service_factory.h"
29 #include "chrome/browser/prefs/pref_service.h" 28 #include "chrome/browser/prefs/pref_service.h"
30 #include "chrome/browser/prefs/scoped_user_pref_update.h" 29 #include "chrome/browser/prefs/scoped_user_pref_update.h"
31 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/ui/browser_finder.h" 31 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_tabstrip.h" 32 #include "chrome/browser/ui/browser_tabstrip.h"
34 #include "chrome/browser/ui/browser_window.h" 33 #include "chrome/browser/ui/browser_window.h"
35 #include "chrome/browser/ui/extensions/application_launch.h" 34 #include "chrome/browser/ui/extensions/application_launch.h"
36 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
38 #include "chrome/browser/ui/webui/web_ui_util.h" 37 #include "chrome/browser/ui/webui/web_ui_util.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 double page_index; 684 double page_index;
686 CHECK(args->GetDouble(2, &page_index)); 685 CHECK(args->GetDouble(2, &page_index));
687 ExtensionSorting* extension_sorting = 686 ExtensionSorting* extension_sorting =
688 extension_service_->extension_prefs()->extension_sorting(); 687 extension_service_->extension_prefs()->extension_sorting();
689 const StringOrdinal& page_ordinal = 688 const StringOrdinal& page_ordinal =
690 extension_sorting->PageIntegerAsStringOrdinal( 689 extension_sorting->PageIntegerAsStringOrdinal(
691 static_cast<size_t>(page_index)); 690 static_cast<size_t>(page_index));
692 691
693 Profile* profile = Profile::FromWebUI(web_ui()); 692 Profile* profile = Profile::FromWebUI(web_ui());
694 FaviconService* favicon_service = 693 FaviconService* favicon_service =
695 FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS); 694 profile->GetFaviconService(Profile::EXPLICIT_ACCESS);
696 if (!favicon_service) { 695 if (!favicon_service) {
697 LOG(ERROR) << "No favicon service"; 696 LOG(ERROR) << "No favicon service";
698 return; 697 return;
699 } 698 }
700 699
701 scoped_ptr<AppInstallInfo> install_info(new AppInstallInfo()); 700 scoped_ptr<AppInstallInfo> install_info(new AppInstallInfo());
702 install_info->is_bookmark_app = true; 701 install_info->is_bookmark_app = true;
703 install_info->title = title; 702 install_info->title = title;
704 install_info->app_url = launch_url; 703 install_info->app_url = launch_url;
705 install_info->page_ordinal = page_ordinal; 704 install_info->page_ordinal = page_ordinal;
706 705
707 FaviconService::Handle h = favicon_service->GetFaviconForURL( 706 FaviconService::Handle h = favicon_service->GetFaviconForURL(
708 profile, launch_url, history::FAVICON, &favicon_consumer_, 707 launch_url, history::FAVICON, &favicon_consumer_,
709 base::Bind(&AppLauncherHandler::OnFaviconForApp, base::Unretained(this))); 708 base::Bind(&AppLauncherHandler::OnFaviconForApp, base::Unretained(this)));
710 favicon_consumer_.SetClientData(favicon_service, h, install_info.release()); 709 favicon_consumer_.SetClientData(favicon_service, h, install_info.release());
711 } 710 }
712 711
713 void AppLauncherHandler::HandleRecordAppLaunchByUrl( 712 void AppLauncherHandler::HandleRecordAppLaunchByUrl(
714 const base::ListValue* args) { 713 const base::ListValue* args) {
715 std::string url; 714 std::string url;
716 CHECK(args->GetString(0, &url)); 715 CHECK(args->GetString(0, &url));
717 double source; 716 double source;
718 CHECK(args->GetDouble(1, &source)); 717 CHECK(args->GetDouble(1, &source));
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 940
942 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() { 941 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() {
943 if (!extension_install_ui_.get()) { 942 if (!extension_install_ui_.get()) {
944 Browser* browser = browser::FindBrowserWithWebContents( 943 Browser* browser = browser::FindBrowserWithWebContents(
945 web_ui()->GetWebContents()); 944 web_ui()->GetWebContents());
946 extension_install_ui_.reset( 945 extension_install_ui_.reset(
947 chrome::CreateExtensionInstallPromptWithBrowser(browser)); 946 chrome::CreateExtensionInstallPromptWithBrowser(browser));
948 } 947 }
949 return extension_install_ui_.get(); 948 return extension_install_ui_.get();
950 } 949 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/android/bookmarks_handler.cc ('k') | chrome/browser/ui/webui/ntp/favicon_webui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698