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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.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, 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"
18 #include "chrome/browser/intents/cws_intents_registry_factory.h" 17 #include "chrome/browser/intents/cws_intents_registry_factory.h"
19 #include "chrome/browser/intents/default_web_intent_service.h" 18 #include "chrome/browser/intents/default_web_intent_service.h"
20 #include "chrome/browser/intents/web_intents_registry_factory.h" 19 #include "chrome/browser/intents/web_intents_registry_factory.h"
21 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/tab_contents/tab_util.h" 21 #include "chrome/browser/tab_contents/tab_util.h"
23 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_finder.h" 23 #include "chrome/browser/ui/browser_finder.h"
25 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_navigator.h" 25 #include "chrome/browser/ui/browser_navigator.h"
27 #include "chrome/browser/ui/browser_tabstrip.h" 26 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 62
64 // Maximum amount of time to delay displaying dialog while waiting for data. 63 // Maximum amount of time to delay displaying dialog while waiting for data.
65 const int kMaxHiddenSetupTimeMs = 200; 64 const int kMaxHiddenSetupTimeMs = 200;
66 65
67 // Minimum amount of time to show waiting dialog, if it is shown. 66 // Minimum amount of time to show waiting dialog, if it is shown.
68 const int kMinThrobberDisplayTimeMs = 2000; 67 const int kMinThrobberDisplayTimeMs = 2000;
69 68
70 69
71 // Gets the favicon service for the profile in |tab_contents|. 70 // Gets the favicon service for the profile in |tab_contents|.
72 FaviconService* GetFaviconService(TabContents* tab_contents) { 71 FaviconService* GetFaviconService(TabContents* tab_contents) {
73 return FaviconServiceFactory::GetForProfile(tab_contents->profile(), 72 return tab_contents->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
74 Profile::EXPLICIT_ACCESS);
75 } 73 }
76 74
77 // Gets the web intents registry for the profile in |tab_contents|. 75 // Gets the web intents registry for the profile in |tab_contents|.
78 WebIntentsRegistry* GetWebIntentsRegistry(TabContents* tab_contents) { 76 WebIntentsRegistry* GetWebIntentsRegistry(TabContents* tab_contents) {
79 return WebIntentsRegistryFactory::GetForProfile(tab_contents->profile()); 77 return WebIntentsRegistryFactory::GetForProfile(tab_contents->profile());
80 } 78 }
81 79
82 // Gets the Chrome web store intents registry for the profile in |tab_contents|. 80 // Gets the Chrome web store intents registry for the profile in |tab_contents|.
83 CWSIntentsRegistry* GetCWSIntentsRegistry(TabContents* tab_contents) { 81 CWSIntentsRegistry* GetCWSIntentsRegistry(TabContents* tab_contents) {
84 return CWSIntentsRegistryFactory::GetForProfile(tab_contents->profile()); 82 return CWSIntentsRegistryFactory::GetForProfile(tab_contents->profile());
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 const webkit_glue::WebIntentServiceData& service) { 496 const webkit_glue::WebIntentServiceData& service) {
499 FaviconService* favicon_service = GetFaviconService(tab_contents_); 497 FaviconService* favicon_service = GetFaviconService(tab_contents_);
500 498
501 picker_model_->AddInstalledService( 499 picker_model_->AddInstalledService(
502 service.title, 500 service.title,
503 service.service_url, 501 service.service_url,
504 service.disposition); 502 service.disposition);
505 503
506 pending_async_count_++; 504 pending_async_count_++;
507 FaviconService::Handle handle = favicon_service->GetFaviconForURL( 505 FaviconService::Handle handle = favicon_service->GetFaviconForURL(
508 tab_contents_->profile(),
509 service.service_url, 506 service.service_url,
510 history::FAVICON, 507 history::FAVICON,
511 &favicon_consumer_, 508 &favicon_consumer_,
512 base::Bind( 509 base::Bind(
513 &WebIntentPickerController::OnFaviconDataAvailable, 510 &WebIntentPickerController::OnFaviconDataAvailable,
514 weak_ptr_factory_.GetWeakPtr())); 511 weak_ptr_factory_.GetWeakPtr()));
515 favicon_consumer_.SetClientData( 512 favicon_consumer_.SetClientData(
516 favicon_service, handle, picker_model_->GetInstalledServiceCount() - 1); 513 favicon_service, handle, picker_model_->GetInstalledServiceCount() - 1);
517 } 514 }
518 515
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 picker_->SetActionString(GetIntentActionString( 887 picker_->SetActionString(GetIntentActionString(
891 UTF16ToUTF8(picker_model_->action()))); 888 UTF16ToUTF8(picker_model_->action())));
892 picker_shown_ = true; 889 picker_shown_ = true;
893 } 890 }
894 891
895 void WebIntentPickerController::ClosePicker() { 892 void WebIntentPickerController::ClosePicker() {
896 SetDialogState(kPickerHidden); 893 SetDialogState(kPickerHidden);
897 if (picker_) 894 if (picker_)
898 picker_->Close(); 895 picker_->Close();
899 } 896 }
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