OLD | NEW |
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 #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/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" | 14 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "webkit/glue/web_intent_data.h" | 17 #include "webkit/glue/web_intent_data.h" |
18 | 18 |
19 class Browser; | 19 class Browser; |
20 class FaviconService; | 20 class FaviconService; |
21 class GURL; | 21 class GURL; |
22 class SkBitmap; | 22 class SkBitmap; |
| 23 class TabContents; |
23 class TabContentsWrapper; | 24 class TabContentsWrapper; |
24 class WebDataService; | 25 class WebDataService; |
25 class WebIntentPicker; | 26 class WebIntentPicker; |
26 class WebIntentPickerFactory; | 27 class WebIntentPickerFactory; |
27 | 28 |
28 namespace webkit_glue { | 29 namespace webkit_glue { |
29 struct WebIntentServiceData; | 30 struct WebIntentServiceData; |
30 } | 31 } |
31 | 32 |
32 // Controls the creation of the WebIntentPicker UI and forwards the user's | 33 // Controls the creation of the WebIntentPicker UI and forwards the user's |
(...skipping 26 matching lines...) Expand all Loading... |
59 virtual void Observe(int type, | 60 virtual void Observe(int type, |
60 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
61 const content::NotificationDetails& details) OVERRIDE; | 62 const content::NotificationDetails& details) OVERRIDE; |
62 | 63 |
63 // WebIntentPickerDelegate implementation. | 64 // WebIntentPickerDelegate implementation. |
64 virtual void OnServiceChosen(size_t index) OVERRIDE; | 65 virtual void OnServiceChosen(size_t index) OVERRIDE; |
65 virtual void OnCancelled() OVERRIDE; | 66 virtual void OnCancelled() OVERRIDE; |
66 virtual void OnClosing() OVERRIDE; | 67 virtual void OnClosing() OVERRIDE; |
67 | 68 |
68 private: | 69 private: |
| 70 // Gets a notification when the return message is sent to the source tab, |
| 71 // so we can close the picker dialog or service tab. |
| 72 void OnSendReturnMessage(); |
| 73 |
69 friend class WebIntentPickerControllerTest; | 74 friend class WebIntentPickerControllerTest; |
70 friend class WebIntentPickerControllerBrowserTest; | 75 friend class WebIntentPickerControllerBrowserTest; |
| 76 friend class InvokingTabObserver; |
71 class WebIntentDataFetcher; | 77 class WebIntentDataFetcher; |
72 class FaviconFetcher; | 78 class FaviconFetcher; |
73 | 79 |
74 int pending_async_count() const { return pending_async_count_; } | 80 int pending_async_count() const { return pending_async_count_; } |
75 | 81 |
76 // Called from the WebIntentDataFetcher when intent data is available. | 82 // Called from the WebIntentDataFetcher when intent data is available. |
77 void OnWebIntentDataAvailable( | 83 void OnWebIntentDataAvailable( |
78 const std::vector<webkit_glue::WebIntentServiceData>& services); | 84 const std::vector<webkit_glue::WebIntentServiceData>& services); |
79 | 85 |
80 // Called from the FaviconDataFetcher when a favicon is available. | 86 // Called from the FaviconDataFetcher when a favicon is available. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // The routing id of the renderer which launched the intent. Should be the | 123 // The routing id of the renderer which launched the intent. Should be the |
118 // renderer associated with the TabContents which owns this object. | 124 // renderer associated with the TabContents which owns this object. |
119 int routing_id_; | 125 int routing_id_; |
120 | 126 |
121 // The intent data from the client. | 127 // The intent data from the client. |
122 webkit_glue::WebIntentData intent_; | 128 webkit_glue::WebIntentData intent_; |
123 | 129 |
124 // The intent ID assigned to this intent by the renderer. | 130 // The intent ID assigned to this intent by the renderer. |
125 int intent_id_; | 131 int intent_id_; |
126 | 132 |
| 133 // Weak pointer to the tab servicing the intent. Remembered in order to |
| 134 // close it when a reply is sent. |
| 135 TabContents* service_tab_; |
| 136 |
127 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 137 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
128 }; | 138 }; |
129 | 139 |
130 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 140 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
OLD | NEW |