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