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