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

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

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/favicon/favicon_service.h" 12 #include "chrome/browser/favicon/favicon_service.h"
13 #include "chrome/browser/intents/web_intents_registry.h" 13 #include "chrome/browser/intents/web_intents_registry.h"
14 #include "chrome/browser/intents/web_intents_registry_factory.h" 14 #include "chrome/browser/intents/web_intents_registry_factory.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/tabs/tab_strip_model.h" 16 #include "chrome/browser/tabs/tab_strip_model.h"
17 #include "chrome/browser/ui/browser_navigator.h" 17 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/intents/web_intent_picker.h" 18 #include "chrome/browser/ui/intents/web_intent_picker.h"
19 #include "chrome/browser/ui/intents/web_intent_picker_factory.h" 19 #include "chrome/browser/ui/intents/web_intent_picker_factory.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
21 #include "chrome/browser/webdata/web_data_service.h" 21 #include "chrome/browser/webdata/web_data_service.h"
22 #include "content/browser/intents/intent_injector.h" 22 #include "content/browser/intents/intent_injector.h"
23 #include "content/browser/tab_contents/tab_contents.h" 23 #include "content/browser/tab_contents/tab_contents.h"
24 #include "content/public/browser/web_intents_dispatcher.h" 24 #include "content/public/browser/web_intents_dispatcher.h"
25 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
26 #include "ui/gfx/codec/png_codec.h" 26 #include "ui/gfx/codec/png_codec.h"
27 #include "webkit/glue/web_intent_service_data.h" 27 #include "webkit/glue/web_intent_service_data.h"
28 28
29 using content::NavigationController;
30
29 namespace { 31 namespace {
30 32
31 // Gets the favicon service for the profile in |tab_contents|. 33 // Gets the favicon service for the profile in |tab_contents|.
32 FaviconService* GetFaviconService(TabContentsWrapper* wrapper) { 34 FaviconService* GetFaviconService(TabContentsWrapper* wrapper) {
33 return wrapper->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 35 return wrapper->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
34 } 36 }
35 37
36 // Gets the web intents registry for the profile in |tab_contents|. 38 // Gets the web intents registry for the profile in |tab_contents|.
37 WebIntentsRegistry* GetWebIntentsRegistry(TabContentsWrapper* wrapper) { 39 WebIntentsRegistry* GetWebIntentsRegistry(TabContentsWrapper* wrapper) {
38 return WebIntentsRegistryFactory::GetForProfile(wrapper->profile()); 40 return WebIntentsRegistryFactory::GetForProfile(wrapper->profile());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 : wrapper_(wrapper), 111 : wrapper_(wrapper),
110 picker_factory_(factory), 112 picker_factory_(factory),
111 web_intent_data_fetcher_( 113 web_intent_data_fetcher_(
112 new WebIntentDataFetcher(this, 114 new WebIntentDataFetcher(this,
113 GetWebIntentsRegistry(wrapper))), 115 GetWebIntentsRegistry(wrapper))),
114 favicon_fetcher_( 116 favicon_fetcher_(
115 new FaviconFetcher(this, GetFaviconService(wrapper))), 117 new FaviconFetcher(this, GetFaviconService(wrapper))),
116 picker_(NULL), 118 picker_(NULL),
117 pending_async_count_(0), 119 pending_async_count_(0),
118 service_tab_(NULL) { 120 service_tab_(NULL) {
119 content::NavigationController* controller = 121 NavigationController* controller = &wrapper->tab_contents()->GetController();
120 &wrapper->tab_contents()->GetController();
121 registrar_.Add(this, content::NOTIFICATION_LOAD_START, 122 registrar_.Add(this, content::NOTIFICATION_LOAD_START,
122 content::Source<content::NavigationController>(controller)); 123 content::Source<NavigationController>(controller));
123 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, 124 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
124 content::Source<content::NavigationController>(controller)); 125 content::Source<NavigationController>(controller));
125 } 126 }
126 127
127 WebIntentPickerController::~WebIntentPickerController() { 128 WebIntentPickerController::~WebIntentPickerController() {
128 } 129 }
129 130
130 void WebIntentPickerController::SetIntentsDispatcher( 131 void WebIntentPickerController::SetIntentsDispatcher(
131 content::WebIntentsDispatcher* intents_dispatcher) { 132 content::WebIntentsDispatcher* intents_dispatcher) {
132 intents_dispatcher_.reset(intents_dispatcher); 133 intents_dispatcher_.reset(intents_dispatcher);
133 intents_dispatcher_->RegisterReplyNotification( 134 intents_dispatcher_->RegisterReplyNotification(
134 base::Bind(&WebIntentPickerController::OnSendReturnMessage, 135 base::Bind(&WebIntentPickerController::OnSendReturnMessage,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), 325 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(),
325 favicon_data.image_data->size(), 326 favicon_data.image_data->size(),
326 &icon_bitmap)) { 327 &icon_bitmap)) {
327 controller_->OnFaviconDataAvailable(index, icon_bitmap); 328 controller_->OnFaviconDataAvailable(index, icon_bitmap);
328 return; 329 return;
329 } 330 }
330 } 331 }
331 332
332 controller_->OnFaviconDataUnavailable(index); 333 controller_->OnFaviconDataUnavailable(index);
333 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698