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

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

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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"
28 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/prefs/scoped_user_pref_update.h" 30 #include "chrome/browser/prefs/scoped_user_pref_update.h"
30 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/browser_finder.h" 32 #include "chrome/browser/ui/browser_finder.h"
32 #include "chrome/browser/ui/browser_tabstrip.h" 33 #include "chrome/browser/ui/browser_tabstrip.h"
33 #include "chrome/browser/ui/browser_window.h" 34 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/browser/ui/extensions/application_launch.h" 35 #include "chrome/browser/ui/extensions/application_launch.h"
35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 36 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
37 #include "chrome/browser/ui/webui/web_ui_util.h" 38 #include "chrome/browser/ui/webui/web_ui_util.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 double page_index; 684 double page_index;
684 CHECK(args->GetDouble(2, &page_index)); 685 CHECK(args->GetDouble(2, &page_index));
685 ExtensionSorting* extension_sorting = 686 ExtensionSorting* extension_sorting =
686 extension_service_->extension_prefs()->extension_sorting(); 687 extension_service_->extension_prefs()->extension_sorting();
687 const StringOrdinal& page_ordinal = 688 const StringOrdinal& page_ordinal =
688 extension_sorting->PageIntegerAsStringOrdinal( 689 extension_sorting->PageIntegerAsStringOrdinal(
689 static_cast<size_t>(page_index)); 690 static_cast<size_t>(page_index));
690 691
691 Profile* profile = Profile::FromWebUI(web_ui()); 692 Profile* profile = Profile::FromWebUI(web_ui());
692 FaviconService* favicon_service = 693 FaviconService* favicon_service =
693 profile->GetFaviconService(Profile::EXPLICIT_ACCESS); 694 FaviconServiceFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS);
694 if (!favicon_service) { 695 if (!favicon_service) {
695 LOG(ERROR) << "No favicon service"; 696 LOG(ERROR) << "No favicon service";
696 return; 697 return;
697 } 698 }
698 699
699 scoped_ptr<AppInstallInfo> install_info(new AppInstallInfo()); 700 scoped_ptr<AppInstallInfo> install_info(new AppInstallInfo());
700 install_info->is_bookmark_app = true; 701 install_info->is_bookmark_app = true;
701 install_info->title = title; 702 install_info->title = title;
702 install_info->app_url = launch_url; 703 install_info->app_url = launch_url;
703 install_info->page_ordinal = page_ordinal; 704 install_info->page_ordinal = page_ordinal;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 940
940 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() { 941 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() {
941 if (!extension_install_ui_.get()) { 942 if (!extension_install_ui_.get()) {
942 Browser* browser = browser::FindBrowserWithWebContents( 943 Browser* browser = browser::FindBrowserWithWebContents(
943 web_ui()->GetWebContents()); 944 web_ui()->GetWebContents());
944 extension_install_ui_.reset( 945 extension_install_ui_.reset(
945 chrome::CreateExtensionInstallPromptWithBrowser(browser)); 946 chrome::CreateExtensionInstallPromptWithBrowser(browser));
946 } 947 }
947 return extension_install_ui_.get(); 948 return extension_install_ui_.get();
948 } 949 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698