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

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

Issue 9430025: [Web Intents] WebIntentsPickerController will now fetch icon for suggested extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 10 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 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "chrome/browser/favicon/favicon_service.h" 15 #include "chrome/browser/favicon/favicon_service.h"
16 #include "chrome/browser/intents/web_intents_registry.h" 16 #include "chrome/browser/intents/web_intents_registry.h"
17 #include "chrome/browser/intents/cws_intents_registry.h" 17 #include "chrome/browser/intents/cws_intents_registry.h"
18 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" 18 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "webkit/glue/web_intent_data.h" 21 #include "webkit/glue/web_intent_data.h"
22 #include "webkit/glue/web_intent_reply_data.h" 22 #include "webkit/glue/web_intent_reply_data.h"
23 23
24 class Browser; 24 class Browser;
25 class GURL; 25 class GURL;
26 class TabContents;
27 class TabContentsWrapper; 26 class TabContentsWrapper;
28 class WebIntentPicker; 27 class WebIntentPicker;
29 class WebIntentPickerModel; 28 class WebIntentPickerModel;
30 29
31 namespace content { 30 namespace content {
32 class WebContents; 31 class WebContents;
33 class WebIntentsDispatcher; 32 class WebIntentsDispatcher;
34 } 33 }
35 34
36 namespace gfx {
37 class Image;
38 }
39
40 namespace webkit_glue { 35 namespace webkit_glue {
41 struct WebIntentServiceData; 36 struct WebIntentServiceData;
42 } 37 }
43 38
44 // Controls the creation of the WebIntentPicker UI and forwards the user's 39 // Controls the creation of the WebIntentPicker UI and forwards the user's
45 // intent handler choice back to the TabContents object. 40 // intent handler choice back to the TabContents object.
46 class WebIntentPickerController : public content::NotificationObserver, 41 class WebIntentPickerController : public content::NotificationObserver,
47 public WebIntentPickerDelegate, 42 public WebIntentPickerDelegate,
48 public WebIntentsRegistry::Consumer { 43 public WebIntentsRegistry::Consumer {
49 public: 44 public:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE; 93 const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE;
99 94
100 // Called when FaviconData is returned from the FaviconService. 95 // Called when FaviconData is returned from the FaviconService.
101 void OnFaviconDataAvailable(FaviconService::Handle handle, 96 void OnFaviconDataAvailable(FaviconService::Handle handle,
102 history::FaviconData favicon_data); 97 history::FaviconData favicon_data);
103 98
104 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry. 99 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry.
105 void OnCWSIntentServicesAvailable( 100 void OnCWSIntentServicesAvailable(
106 const CWSIntentsRegistry::IntentExtensionList& extensions); 101 const CWSIntentsRegistry::IntentExtensionList& extensions);
107 102
103 // Called when a suggested extension's icon is fetched.
104 void OnExtensionIconURLFetchComplete(const string16& extension_id,
105 const content::URLFetcher* source);
106
107 typedef base::Callback<void(const gfx::Image&)>
108 ExtensionIconAvailableCallback;
109 // Called on a worker thread to decode and resize the extension's icon.
110 static void DecodeExtensionIconAndResize(
111 scoped_ptr<std::string> icon_response,
112 const ExtensionIconAvailableCallback& callback,
113 const base::Closure& unavailable_callback);
114
115 // Called when an extension's icon is successfully decoded and resized.
116 void OnExtensionIconAvailable(const string16& extension_id,
117 const gfx::Image& icon_image);
118
119 // Called when an extension's icon failed to be decoded or resized.
120 void OnExtensionIconUnavailable(const string16& extension_id);
121
108 // Decrements the |pending_async_count_| and notifies the picker if it 122 // Decrements the |pending_async_count_| and notifies the picker if it
109 // reaches zero. 123 // reaches zero.
110 void AsyncOperationFinished(); 124 void AsyncOperationFinished();
111 125
112 // Closes the currently active picker. 126 // Closes the currently active picker.
113 void ClosePicker(); 127 void ClosePicker();
114 128
115 // A weak pointer to the tab contents that the picker is displayed on. 129 // A weak pointer to the tab contents that the picker is displayed on.
116 TabContentsWrapper* wrapper_; 130 TabContentsWrapper* wrapper_;
117 131
(...skipping 27 matching lines...) Expand all
145 159
146 // Request consumer used when asynchronously loading favicons. 160 // Request consumer used when asynchronously loading favicons.
147 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; 161 CancelableRequestConsumerTSimple<size_t> favicon_consumer_;
148 162
149 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; 163 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_;
150 164
151 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); 165 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController);
152 }; 166 };
153 167
154 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 168 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/web_intent_picker_gtk.cc ('k') | chrome/browser/ui/intents/web_intent_picker_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698