OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 // A dialog box that shows the user various profiles that currently exist |
| 6 // and lets the user select one. |
| 7 |
| 8 #ifndef CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ |
| 9 #define CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ |
| 10 |
| 11 #include <vector> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/message_loop.h" |
| 15 #include "base/ref_counted.h" |
| 16 #include "chrome/browser/shell_dialogs.h" |
| 17 #include "chrome/browser/user_data_manager.h" |
| 18 #include "chrome/views/combo_box.h" |
| 19 #include "chrome/views/dialog_delegate.h" |
| 20 |
| 21 class SelectProfileDialogHelper; |
| 22 namespace views { |
| 23 class Label; |
| 24 class Window; |
| 25 } |
| 26 |
| 27 // Dialog to allow the user to select a profile to open a new window. |
| 28 class SelectProfileDialog |
| 29 : public views::DialogDelegate, |
| 30 public views::View, |
| 31 public views::ComboBox::Model, |
| 32 public GetProfilesHelper::Delegate { |
| 33 public: |
| 34 // Creates and runs the dialog. |
| 35 static void RunDialog(); |
| 36 |
| 37 virtual ~SelectProfileDialog(); |
| 38 |
| 39 // Populates the list of profiles from the given vector. |
| 40 void PopulateProfilesComboBox(const std::vector<std::wstring>& profiles); |
| 41 |
| 42 // Returns the profile name selected by the user. |
| 43 std::wstring profile_name() { return profile_name_; } |
| 44 |
| 45 // views::View methods. |
| 46 virtual gfx::Size GetPreferredSize(); |
| 47 virtual void Layout(); |
| 48 |
| 49 // views::DialogDelegate Methods: |
| 50 virtual bool Accept(); |
| 51 virtual bool Cancel(); |
| 52 virtual views::View* GetContentsView(); |
| 53 virtual int GetDialogButtons() const; |
| 54 virtual views::View* GetInitiallyFocusedView() const; |
| 55 virtual std::wstring GetWindowTitle() const; |
| 56 virtual bool IsDialogButtonEnabled(DialogButton button) const; |
| 57 virtual bool IsModal() const { return false; } |
| 58 |
| 59 // views::ComboBox::Model methods. |
| 60 virtual int GetItemCount(views::ComboBox* source); |
| 61 virtual std::wstring GetItemAt(views::ComboBox* source, int index); |
| 62 |
| 63 // GetProfilesHelper::Delegate method. |
| 64 virtual void OnGetProfilesDone(const std::vector<std::wstring>& profiles); |
| 65 |
| 66 private: |
| 67 SelectProfileDialog(); |
| 68 |
| 69 // Sets up all UI controls for the dialog. |
| 70 void SetupControls(); |
| 71 |
| 72 // UI controls. |
| 73 views::ComboBox* profile_combobox_; |
| 74 views::Label* select_profile_label_; |
| 75 |
| 76 std::vector<std::wstring> profiles_; |
| 77 std::wstring profile_name_; |
| 78 |
| 79 // Helper instance that handles all task posting activities. |
| 80 scoped_refptr<GetProfilesHelper> helper_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(SelectProfileDialog); |
| 83 }; |
| 84 |
| 85 #endif // CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ |
OLD | NEW |