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

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

Issue 10805094: Mark down in web intents picker controller when it is part of a TabContents that is hosting a web i… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change assert Created 8 years, 5 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // Sets the intent data and return pathway handler object for which 51 // Sets the intent data and return pathway handler object for which
52 // this picker was created. The picker takes ownership of 52 // this picker was created. The picker takes ownership of
53 // |intents_dispatcher|. |intents_dispatcher| must not be NULL. 53 // |intents_dispatcher|. |intents_dispatcher| must not be NULL.
54 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher); 54 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher);
55 55
56 // Shows the web intent picker given the intent |action| and MIME-type |type|. 56 // Shows the web intent picker given the intent |action| and MIME-type |type|.
57 void ShowDialog(const string16& action, 57 void ShowDialog(const string16& action,
58 const string16& type); 58 const string16& type);
59 59
60 // Called by the location bar to see whether the web intents picker affordance
61 // should be shown. TODO(gbillock): refactor this into a
62 // LocationBarPageToolModel.
63 bool ShowLocationBarPickerTool();
64
65 // Called to notify a controller for a page hosting a web intents service
66 // that the source WebContents has been destroyed.
67 void SourceWebContentsDestroyed(content::WebContents* source);
68
60 protected: 69 protected:
61 // content::NotificationObserver implementation. 70 // content::NotificationObserver implementation.
62 virtual void Observe(int type, 71 virtual void Observe(int type,
63 const content::NotificationSource& source, 72 const content::NotificationSource& source,
64 const content::NotificationDetails& details) OVERRIDE; 73 const content::NotificationDetails& details) OVERRIDE;
65 74
66 // WebIntentPickerDelegate implementation. 75 // WebIntentPickerDelegate implementation.
67 virtual void OnServiceChosen(const GURL& url, 76 virtual void OnServiceChosen(const GURL& url,
68 Disposition disposition) OVERRIDE; 77 Disposition disposition) OVERRIDE;
69 virtual void OnInlineDispositionWebContentsCreated( 78 virtual void OnInlineDispositionWebContentsCreated(
70 content::WebContents* web_contents) OVERRIDE; 79 content::WebContents* web_contents) OVERRIDE;
71 virtual void OnExtensionInstallRequested(const std::string& id) OVERRIDE; 80 virtual void OnExtensionInstallRequested(const std::string& id) OVERRIDE;
72 virtual void OnExtensionLinkClicked(const std::string& id) OVERRIDE; 81 virtual void OnExtensionLinkClicked(const std::string& id) OVERRIDE;
73 virtual void OnSuggestionsLinkClicked() OVERRIDE; 82 virtual void OnSuggestionsLinkClicked() OVERRIDE;
74 virtual void OnPickerClosed() OVERRIDE; 83 virtual void OnPickerClosed() OVERRIDE;
75 virtual void OnChooseAnotherService() OVERRIDE; 84 virtual void OnChooseAnotherService() OVERRIDE;
76 virtual void OnClosing() OVERRIDE; 85 virtual void OnClosing() OVERRIDE;
77 86
78 // extensions::WebstoreInstaller::Delegate implementation. 87 // extensions::WebstoreInstaller::Delegate implementation.
79 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; 88 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
80 virtual void OnExtensionInstallFailure(const std::string& id, 89 virtual void OnExtensionInstallFailure(const std::string& id,
81 const std::string& error) OVERRIDE; 90 const std::string& error) OVERRIDE;
82 91
83 private: 92 private:
84 friend class WebIntentPickerControllerTest; 93 friend class WebIntentPickerControllerTest;
85 friend class WebIntentPickerControllerBrowserTest; 94 friend class WebIntentPickerControllerBrowserTest;
86 friend class WebIntentPickerControllerIncognitoBrowserTest; 95 friend class WebIntentPickerControllerIncognitoBrowserTest;
87 friend class InvokingTabObserver;
88 96
89 // Gets a notification when the return message is sent to the source tab, 97 // Gets a notification when the return message is sent to the source tab,
90 // so we can close the picker dialog or service tab. 98 // so we can close the picker dialog or service tab.
91 void OnSendReturnMessage(webkit_glue::WebIntentReplyType reply_type); 99 void OnSendReturnMessage(webkit_glue::WebIntentReplyType reply_type);
92 100
93 // Exposed for tests only. 101 // Exposed for tests only.
94 void set_picker(WebIntentPicker* picker) { picker_ = picker; } 102 void set_picker(WebIntentPicker* picker) { picker_ = picker; }
95 103
96 // Exposed for tests only. 104 // Exposed for tests only.
97 void set_model_observer(WebIntentPickerModelObserver* observer) { 105 void set_model_observer(WebIntentPickerModelObserver* observer) {
98 picker_model_->set_observer(observer); 106 picker_model_->set_observer(observer);
99 } 107 }
100 108
109 // Notify the controller that its TabContents is hosting a web intents
110 // service. Sets the source and dispatcher for the invoking client.
111 void SetWindowDispositionSource(content::WebContents* source,
112 content::WebIntentsDispatcher* dispatcher);
113
114 // Called to notify a controller for a page hosting a web intents service
115 // that the source dispatcher has been replied on.
116 void SourceDispatcherReplied(webkit_glue::WebIntentReplyType reply_type);
117
101 // Called by the WebIntentsRegistry, returning |services|, which is 118 // Called by the WebIntentsRegistry, returning |services|, which is
102 // a list of WebIntentServiceData matching the query. 119 // a list of WebIntentServiceData matching the query.
103 void OnWebIntentServicesAvailable( 120 void OnWebIntentServicesAvailable(
104 const std::vector<webkit_glue::WebIntentServiceData>& services); 121 const std::vector<webkit_glue::WebIntentServiceData>& services);
105 122
106 // Called when a default service is returned from the WebIntentsRegistry. 123 // Called when a default service is returned from the WebIntentsRegistry.
107 // (Still called with default_service.service_url empty if there are no 124 // (Still called with default_service.service_url empty if there are no
108 // defaults.) 125 // defaults.)
109 void OnWebIntentDefaultsAvailable( 126 void OnWebIntentDefaultsAvailable(
110 const DefaultWebIntentService& default_service); 127 const DefaultWebIntentService& default_service);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int pending_async_count_; 199 int pending_async_count_;
183 200
184 // A count of outstanding WebIntentsRegistry calls. 201 // A count of outstanding WebIntentsRegistry calls.
185 int pending_registry_calls_count_; 202 int pending_registry_calls_count_;
186 203
187 // Is true if the picker is currently visible. 204 // Is true if the picker is currently visible.
188 // This bool is not equivalent to picker != NULL in a unit test. In that 205 // This bool is not equivalent to picker != NULL in a unit test. In that
189 // case, a picker may be non-NULL before it is shown. 206 // case, a picker may be non-NULL before it is shown.
190 bool picker_shown_; 207 bool picker_shown_;
191 208
209 // Weak pointer to the source WebContents for the intent if the TabContents
210 // with which this controller is associated is hosting a web intents window
211 // disposition service.
212 content::WebContents* window_disposition_source_;
213
214 // If this tab is hosting a web intents service, a weak pointer to dispatcher
215 // that invoked us. Weak pointer.
216 content::WebIntentsDispatcher* source_intents_dispatcher_;
217
192 // Weak pointer to the routing object for the renderer which launched the 218 // Weak pointer to the routing object for the renderer which launched the
193 // intent. Contains the intent data and a way to signal back to the 219 // intent. Contains the intent data and a way to signal back to the
194 // client page. 220 // client page.
195 content::WebIntentsDispatcher* intents_dispatcher_; 221 content::WebIntentsDispatcher* intents_dispatcher_;
196 222
197 // Weak pointer to the tab servicing the intent. Remembered in order to 223 // Weak pointer to the tab servicing the intent. Remembered in order to
198 // close it when a reply is sent. 224 // close it when a reply is sent.
199 content::WebContents* service_tab_; 225 content::WebContents* service_tab_;
200 226
201 // Request consumer used when asynchronously loading favicons. 227 // Request consumer used when asynchronously loading favicons.
202 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; 228 CancelableRequestConsumerTSimple<size_t> favicon_consumer_;
203 229
204 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; 230 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_;
205 231
206 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); 232 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController);
207 }; 233 };
208 234
209 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 235 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698