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

Unified Diff: chrome/browser/ui/intents/web_intent_picker_controller.h

Issue 10827238: [WebIntents, Gtk] "Waiting for Suggestion" dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update Gtk dialog to look decent. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/intents/web_intent_picker_controller.h
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.h b/chrome/browser/ui/intents/web_intent_picker_controller.h
index ce7406951ac289889e1c1e05eed32a6b3f36703b..27939fc90fc9c6b57fde0cd64555425adc505f88 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.h
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.h
@@ -45,6 +45,24 @@ class WebIntentPickerController
public WebIntentPickerDelegate,
public extensions::WebstoreInstaller::Delegate {
public:
+
+ // The various states that the UI may be in. Public for testing.
+ enum WebIntentPickerState {
Greg Billock 2012/08/10 18:46:57 This is slop from the refactor, no?
groby-ooo-7-16 2012/08/10 18:57:27 I'm not sure what you're asking :) On 2012/08/10
+ kPickerHidden, // Picker not displayed at all.
+ kPickerSetup, // Initial setup. Acquires data, keeps picker hidden.
+ kPickerWaiting, // Displaying "waiting for CWS".
+ kPickerWaitLong, // "waiting" has displayed for longer than min. time.
+ kPickerMain, // Displaying main picker dialog.
+ };
+
+ // Events that happen during picker life time. Drive state machine.
+ enum WebIntentPickerEvent {
+ kPickerEventHiddenSetupTimeout, // Time for hidden setup exired.
+ kPickerEventMaxWaitTimeExceeded, // Exceeded max wait time for CWS results.
+ kPickerEventRegistryData, // Data from the registry has arrived.
+ kPickerEventDataComplete, // Data from registry and CWS has arrived.
+ };
+
explicit WebIntentPickerController(TabContents* tab_contents);
virtual ~WebIntentPickerController();
@@ -150,6 +168,9 @@ class WebIntentPickerController
void OnExtensionIconURLFetchComplete(const string16& extension_id,
const net::URLFetcher* source);
+ // Called whenever intent data (both from registry and CWS) arrives.
+ void OnIntentDataArrived();
+
typedef base::Callback<void(const gfx::Image&)>
ExtensionIconAvailableCallback;
// Called on a worker thread to decode and resize the extension's icon.
@@ -171,16 +192,27 @@ class WebIntentPickerController
void OnExtensionInstallServiceAvailable(
const std::vector<webkit_glue::WebIntentServiceData>& services);
+ // Signals that a picker event has occurred.
+ void OnPickerEvent(WebIntentPickerEvent event);
+
// Decrements the |pending_async_count_| and notifies the picker if it
// reaches zero.
void AsyncOperationFinished();
+ // Invoke the specified service at |service_url| with chosen |disposition|.
+ void InvokeService(const WebIntentPickerModel::InstalledService& service);
+
+ // Sets current dialog state.
+ void SetDialogState(WebIntentPickerState state);
+
// Helper to create picker dialog UI.
void CreatePicker();
// Closes the currently active picker.
void ClosePicker();
+ WebIntentPickerState dialog_state_; // Current state of the dialog.
+
// A weak pointer to the tab contents that the picker is displayed on.
TabContents* tab_contents_;
@@ -201,6 +233,9 @@ class WebIntentPickerController
// A count of outstanding WebIntentsRegistry calls.
int pending_registry_calls_count_;
+ // Indicator that there is a pending request for cws data.
+ bool pending_cws_request_;
+
// Is true if the picker is currently visible.
// This bool is not equivalent to picker != NULL in a unit test. In that
// case, a picker may be non-NULL before it is shown.
@@ -229,6 +264,9 @@ class WebIntentPickerController
base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_;
+ // Timer factory for minimum display time of "waiting" dialog.
+ base::WeakPtrFactory<WebIntentPickerController> timer_factory_;
+
DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController);
};

Powered by Google App Engine
This is Rietveld 408576698