| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_H_ |
| 6 #define CHROME_BROWSER_REMOTING_SETUP_FLOW_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "app/l10n_util.h" |
| 12 #include "base/time.h" |
| 13 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 14 #include "gfx/native_widget_types.h" |
| 15 #include "grit/generated_resources.h" |
| 16 |
| 17 namespace remoting_setup { |
| 18 |
| 19 // The state machine used by Remoting for setup wizard. |
| 20 class SetupFlow : public HtmlDialogUIDelegate { |
| 21 public: |
| 22 virtual ~SetupFlow(); |
| 23 |
| 24 // Runs a flow from |start| to |end|, and does the work of actually showing |
| 25 // the HTML dialog. |container| is kept up-to-date with the lifetime of the |
| 26 // flow (e.g it is emptied on dialog close). |
| 27 static SetupFlow* Run(Profile* service); |
| 28 |
| 29 // Fills |args| with "user" and "error" arguments by querying |service|. |
| 30 static void GetArgsForGaiaLogin(DictionaryValue* args); |
| 31 |
| 32 // Triggers a state machine transition to advance_state. |
| 33 void Advance(); |
| 34 |
| 35 // Focuses the dialog. This is useful in cases where the dialog has been |
| 36 // obscured by a browser window. |
| 37 void Focus(); |
| 38 |
| 39 // HtmlDialogUIDelegate implementation. |
| 40 // Get the HTML file path for the content to load in the dialog. |
| 41 virtual GURL GetDialogContentURL() const { |
| 42 return GURL("chrome://remotingresources/setup"); |
| 43 } |
| 44 |
| 45 // HtmlDialogUIDelegate implementation. |
| 46 virtual void GetDOMMessageHandlers( |
| 47 std::vector<DOMMessageHandler*>* handlers) const; |
| 48 |
| 49 // HtmlDialogUIDelegate implementation. |
| 50 // Get the size of the dialog. |
| 51 virtual void GetDialogSize(gfx::Size* size) const; |
| 52 |
| 53 // HtmlDialogUIDelegate implementation. |
| 54 // Gets the JSON string input to use when opening the dialog. |
| 55 virtual std::string GetDialogArgs() const { |
| 56 return dialog_start_args_; |
| 57 } |
| 58 |
| 59 // HtmlDialogUIDelegate implementation. |
| 60 // A callback to notify the delegate that the dialog closed. |
| 61 virtual void OnDialogClosed(const std::string& json_retval); |
| 62 |
| 63 // HtmlDialogUIDelegate implementation. |
| 64 virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { } |
| 65 |
| 66 // HtmlDialogUIDelegate implementation. |
| 67 virtual std::wstring GetDialogTitle() const { |
| 68 return l10n_util::GetString(IDS_REMOTING_SETUP_DIALOG_TITLE); |
| 69 } |
| 70 |
| 71 // HtmlDialogUIDelegate implementation. |
| 72 virtual bool IsDialogModal() const { |
| 73 return false; |
| 74 } |
| 75 |
| 76 void OnUserClickedCustomize() { |
| 77 // TODO(pranavk): Implement this method. |
| 78 } |
| 79 |
| 80 bool ClickCustomizeOk() { |
| 81 // TODO(pranavk): Implement this method. |
| 82 return true; |
| 83 } |
| 84 |
| 85 void ClickCustomizeCancel() { |
| 86 // TODO(pranavk): Implement this method. |
| 87 } |
| 88 |
| 89 private: |
| 90 |
| 91 // Use static Run method to get an instance. |
| 92 SetupFlow(const std::string& args, Profile* profile); |
| 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(SetupFlow); |
| 95 |
| 96 std::string dialog_start_args_; // The args to pass to the initial page. |
| 97 |
| 98 Profile* profile_; |
| 99 }; |
| 100 |
| 101 } // namespace remoting_setup |
| 102 |
| 103 #endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_H_ |
| OLD | NEW |