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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resyncing with library after revert 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/intents/web_intent_picker_controller.h" 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/platform_app_launcher.h" 14 #include "chrome/browser/extensions/platform_app_launcher.h"
15 #include "chrome/browser/extensions/webstore_installer.h" 15 #include "chrome/browser/extensions/webstore_installer.h"
16 #include "chrome/browser/favicon/favicon_service.h" 16 #include "chrome/browser/favicon/favicon_service.h"
17 #include "chrome/browser/favicon/favicon_service_factory.h"
17 #include "chrome/browser/intents/cws_intents_registry_factory.h" 18 #include "chrome/browser/intents/cws_intents_registry_factory.h"
18 #include "chrome/browser/intents/default_web_intent_service.h" 19 #include "chrome/browser/intents/default_web_intent_service.h"
19 #include "chrome/browser/intents/web_intents_registry_factory.h" 20 #include "chrome/browser/intents/web_intents_registry_factory.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/tab_contents/tab_util.h" 22 #include "chrome/browser/tab_contents/tab_util.h"
22 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_finder.h" 24 #include "chrome/browser/ui/browser_finder.h"
24 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
25 #include "chrome/browser/ui/browser_navigator.h" 26 #include "chrome/browser/ui/browser_navigator.h"
26 #include "chrome/browser/ui/browser_tabstrip.h" 27 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 // Maximum amount of time to delay displaying dialog while waiting for data. 64 // Maximum amount of time to delay displaying dialog while waiting for data.
64 const int kMaxHiddenSetupTimeMs = 200; 65 const int kMaxHiddenSetupTimeMs = 200;
65 66
66 // Minimum amount of time to show waiting dialog, if it is shown. 67 // Minimum amount of time to show waiting dialog, if it is shown.
67 const int kMinThrobberDisplayTimeMs = 2000; 68 const int kMinThrobberDisplayTimeMs = 2000;
68 69
69 70
70 // Gets the favicon service for the profile in |tab_contents|. 71 // Gets the favicon service for the profile in |tab_contents|.
71 FaviconService* GetFaviconService(TabContents* tab_contents) { 72 FaviconService* GetFaviconService(TabContents* tab_contents) {
72 return tab_contents->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 73 return FaviconServiceFactory::GetForProfile(tab_contents->profile(),
74 Profile::EXPLICIT_ACCESS);
73 } 75 }
74 76
75 // Gets the web intents registry for the profile in |tab_contents|. 77 // Gets the web intents registry for the profile in |tab_contents|.
76 WebIntentsRegistry* GetWebIntentsRegistry(TabContents* tab_contents) { 78 WebIntentsRegistry* GetWebIntentsRegistry(TabContents* tab_contents) {
77 return WebIntentsRegistryFactory::GetForProfile(tab_contents->profile()); 79 return WebIntentsRegistryFactory::GetForProfile(tab_contents->profile());
78 } 80 }
79 81
80 // Gets the Chrome web store intents registry for the profile in |tab_contents|. 82 // Gets the Chrome web store intents registry for the profile in |tab_contents|.
81 CWSIntentsRegistry* GetCWSIntentsRegistry(TabContents* tab_contents) { 83 CWSIntentsRegistry* GetCWSIntentsRegistry(TabContents* tab_contents) {
82 return CWSIntentsRegistryFactory::GetForProfile(tab_contents->profile()); 84 return CWSIntentsRegistryFactory::GetForProfile(tab_contents->profile());
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 const webkit_glue::WebIntentServiceData& service) { 498 const webkit_glue::WebIntentServiceData& service) {
497 FaviconService* favicon_service = GetFaviconService(tab_contents_); 499 FaviconService* favicon_service = GetFaviconService(tab_contents_);
498 500
499 picker_model_->AddInstalledService( 501 picker_model_->AddInstalledService(
500 service.title, 502 service.title,
501 service.service_url, 503 service.service_url,
502 service.disposition); 504 service.disposition);
503 505
504 pending_async_count_++; 506 pending_async_count_++;
505 FaviconService::Handle handle = favicon_service->GetFaviconForURL( 507 FaviconService::Handle handle = favicon_service->GetFaviconForURL(
508 tab_contents_->profile(),
506 service.service_url, 509 service.service_url,
507 history::FAVICON, 510 history::FAVICON,
508 &favicon_consumer_, 511 &favicon_consumer_,
509 base::Bind( 512 base::Bind(
510 &WebIntentPickerController::OnFaviconDataAvailable, 513 &WebIntentPickerController::OnFaviconDataAvailable,
511 weak_ptr_factory_.GetWeakPtr())); 514 weak_ptr_factory_.GetWeakPtr()));
512 favicon_consumer_.SetClientData( 515 favicon_consumer_.SetClientData(
513 favicon_service, handle, picker_model_->GetInstalledServiceCount() - 1); 516 favicon_service, handle, picker_model_->GetInstalledServiceCount() - 1);
514 } 517 }
515 518
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 picker_->SetActionString(GetIntentActionString( 890 picker_->SetActionString(GetIntentActionString(
888 UTF16ToUTF8(picker_model_->action()))); 891 UTF16ToUTF8(picker_model_->action())));
889 picker_shown_ = true; 892 picker_shown_ = true;
890 } 893 }
891 894
892 void WebIntentPickerController::ClosePicker() { 895 void WebIntentPickerController::ClosePicker() {
893 SetDialogState(kPickerHidden); 896 SetDialogState(kPickerHidden);
894 if (picker_) 897 if (picker_)
895 picker_->Close(); 898 picker_->Close();
896 } 899 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/history_menu_bridge.mm ('k') | chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698