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

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

Issue 8666013: Add a public content/ interface for intents. Use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments and comment fixes Created 9 years 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/intents/web_intent_picker_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 TabContents;
23 class TabContentsWrapper; 23 class TabContentsWrapper;
24 class WebIntentPicker; 24 class WebIntentPicker;
25 class WebIntentPickerFactory; 25 class WebIntentPickerFactory;
26 26
27 namespace content {
28 class IntentsHost;
29 }
30
27 namespace webkit_glue { 31 namespace webkit_glue {
28 struct WebIntentServiceData; 32 struct WebIntentServiceData;
29 } 33 }
30 34
31 // Controls the creation of the WebIntentPicker UI and forwards the user's 35 // Controls the creation of the WebIntentPicker UI and forwards the user's
32 // intent handler choice back to the TabContents object. 36 // intent handler choice back to the TabContents object.
33 class WebIntentPickerController : public content::NotificationObserver, 37 class WebIntentPickerController : public content::NotificationObserver,
34 public WebIntentPickerDelegate { 38 public WebIntentPickerDelegate {
35 public: 39 public:
36 // Takes ownership of |factory|. 40 // Takes ownership of |factory|.
37 WebIntentPickerController(TabContentsWrapper* wrapper, 41 WebIntentPickerController(TabContentsWrapper* wrapper,
38 WebIntentPickerFactory* factory); 42 WebIntentPickerFactory* factory);
39 virtual ~WebIntentPickerController(); 43 virtual ~WebIntentPickerController();
40 44
41 // Sets the intent data for which this picker was created. The picker will 45 // Sets the intent data and return pathway handler object for which
42 // copy and hold this data until the user has made a service selection. 46 // this picker was created. The picker takes ownership of |intents_host|.
43 // |routing_id| is the IPC routing ID of the source renderer. 47 // Must not be NULL.
James Hawkins 2011/11/29 19:20:04 To be clear: "|intents_host| must not be NULL."
Greg Billock 2011/11/29 23:41:40 Done.
44 // |intent| is the intent data as created by the client content. 48 void SetIntentsHost(content::IntentsHost* intents_host);
45 // |intent_id| is the ID assigned by the source renderer.
46 void SetIntent(int routing_id,
47 const webkit_glue::WebIntentData& intent,
48 int intent_id);
49 49
50 // Shows the web intent picker for |browser|, given the intent 50 // Shows the web intent picker for |browser|, given the intent
51 // |action| and MIME-type |type|. 51 // |action| and MIME-type |type|.
52 void ShowDialog(Browser* browser, 52 void ShowDialog(Browser* browser,
53 const string16& action, 53 const string16& action,
54 const string16& type); 54 const string16& type);
55 55
56 protected: 56 protected:
57 // content::NotificationObserver implementation. 57 // content::NotificationObserver implementation.
58 virtual void Observe(int type, 58 virtual void Observe(int type,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // A list of URLs to display in the UI. 112 // A list of URLs to display in the UI.
113 std::vector<GURL> urls_; 113 std::vector<GURL> urls_;
114 114
115 // A list of the service data on display in the UI. 115 // A list of the service data on display in the UI.
116 std::vector<webkit_glue::WebIntentServiceData> service_data_; 116 std::vector<webkit_glue::WebIntentServiceData> service_data_;
117 117
118 // A count of the outstanding asynchronous calls. 118 // A count of the outstanding asynchronous calls.
119 int pending_async_count_; 119 int pending_async_count_;
120 120
121 // The routing id of the renderer which launched the intent. Should be the 121 // The routing object for the renderer which launched the intent.
122 // renderer associated with the TabContents which owns this object. 122 // Contains the intent data and a way to signal back to the client page.
123 int routing_id_; 123 scoped_ptr<content::IntentsHost> intents_host_;
124
125 // The intent data from the client.
126 webkit_glue::WebIntentData intent_;
127
128 // The intent ID assigned to this intent by the renderer.
129 int intent_id_;
130 124
131 // Weak pointer to the tab servicing the intent. Remembered in order to 125 // Weak pointer to the tab servicing the intent. Remembered in order to
132 // close it when a reply is sent. 126 // close it when a reply is sent.
133 TabContents* service_tab_; 127 TabContents* service_tab_;
134 128
135 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); 129 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController);
136 }; 130 };
137 131
138 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 132 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.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