OLD | NEW |
---|---|
1 // Copyright (c) 2010 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_VIEWS_URL_PICKER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/controls/button/native_button.h" | 9 #include "views/controls/button/native_button.h" |
10 #include "views/controls/table/table_view_observer.h" | 10 #include "views/controls/table/table_view_observer.h" |
11 #include "views/controls/textfield/textfield.h" | 11 #include "views/controls/textfield/textfield_controller.h" |
12 #include "views/view.h" | 12 #include "views/view.h" |
13 #include "views/window/dialog_delegate.h" | 13 #include "views/window/dialog_delegate.h" |
14 #include "views/window/window.h" | 14 #include "views/window/window.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class Button; | 17 class Button; |
18 class Label; | 18 class Label; |
19 class TableView; | 19 class TableView; |
20 } | 20 } |
21 | 21 |
(...skipping 13 matching lines...) Expand all Loading... | |
35 | 35 |
36 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
37 // | 37 // |
38 // This class implements the dialog that let the user add a bookmark or page | 38 // This class implements the dialog that let the user add a bookmark or page |
39 // to the list of urls to open on startup. | 39 // to the list of urls to open on startup. |
40 // UrlPicker deletes itself when the dialog is closed. | 40 // UrlPicker deletes itself when the dialog is closed. |
41 // | 41 // |
42 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
43 class UrlPicker : public views::View, | 43 class UrlPicker : public views::View, |
44 public views::DialogDelegate, | 44 public views::DialogDelegate, |
45 public views::Textfield::Controller, | 45 public views::TextfieldController, |
46 public views::TableViewObserver { | 46 public views::TableViewObserver { |
47 public: | 47 public: |
48 UrlPicker(UrlPickerDelegate* delegate, | 48 UrlPicker(UrlPickerDelegate* delegate, Profile* profile); |
sky
2011/03/09 17:02:33
It's find to leave everything on the same line whe
| |
49 Profile* profile); | |
50 virtual ~UrlPicker(); | 49 virtual ~UrlPicker(); |
51 | 50 |
52 // Show the dialog on the provided contents. | 51 // Show the dialog on the provided contents. |
53 virtual void Show(HWND parent); | 52 virtual void Show(HWND parent); |
54 | 53 |
55 // Closes the dialog. | 54 // Closes the dialog. |
56 void Close(); | 55 void Close(); |
57 | 56 |
58 // DialogDelegate. | 57 // views::DialogDelegate: |
59 virtual std::wstring GetWindowTitle() const; | 58 virtual std::wstring GetWindowTitle() const; |
60 virtual bool IsModal() const; | 59 virtual bool IsModal() const; |
61 virtual std::wstring GetDialogButtonLabel( | 60 virtual std::wstring GetDialogButtonLabel( |
62 MessageBoxFlags::DialogButton button) const; | 61 MessageBoxFlags::DialogButton button) const; |
63 virtual bool Accept(); | 62 virtual bool Accept(); |
64 virtual int GetDefaultDialogButton() const; | 63 virtual int GetDefaultDialogButton() const; |
65 virtual bool IsDialogButtonEnabled( | 64 virtual bool IsDialogButtonEnabled( |
66 MessageBoxFlags::DialogButton button) const; | 65 MessageBoxFlags::DialogButton button) const; |
67 virtual views::View* GetContentsView(); | 66 virtual views::View* GetContentsView(); |
68 | 67 |
69 // TextField::Controller. | 68 // views::TextFieldController: |
70 virtual void ContentsChanged(views::Textfield* sender, | 69 virtual void ContentsChanged(views::Textfield* sender, |
71 const std::wstring& new_contents); | 70 const std::wstring& new_contents); |
72 virtual bool HandleKeyEvent(views::Textfield* sender, | 71 virtual bool HandleKeyEvent(views::Textfield* sender, |
73 const views::KeyEvent& key_event) { | 72 const views::KeyEvent& key_event) { |
74 return false; | 73 return false; |
75 } | 74 } |
76 | 75 |
77 // Overridden from View. | 76 // views::View: |
78 virtual gfx::Size GetPreferredSize(); | 77 virtual gfx::Size GetPreferredSize(); |
79 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 78 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
80 | 79 |
81 // TableViewObserver. | 80 // views::TableViewObserver: |
82 virtual void OnSelectionChanged(); | 81 virtual void OnSelectionChanged(); |
83 virtual void OnDoubleClick(); | 82 virtual void OnDoubleClick(); |
84 | 83 |
85 private: | 84 private: |
86 // Modify the model from the user interface. | 85 // Modify the model from the user interface. |
87 void PerformModelChange(); | 86 void PerformModelChange(); |
88 | 87 |
89 // Returns the URL the user has typed. | 88 // Returns the URL the user has typed. |
90 GURL GetInputURL() const; | 89 GURL GetInputURL() const; |
91 | 90 |
92 // Profile. | 91 // Profile. |
93 Profile* profile_; | 92 Profile* profile_; |
94 | 93 |
95 // URL Field. | 94 // URL Field. |
96 views::Textfield* url_field_; | 95 views::Textfield* url_field_; |
97 | 96 |
98 // The table model. | 97 // The table model. |
99 scoped_ptr<PossibleURLModel> url_table_model_; | 98 scoped_ptr<PossibleURLModel> url_table_model_; |
100 | 99 |
101 // The table of visited urls. | 100 // The table of visited urls. |
102 views::TableView* url_table_; | 101 views::TableView* url_table_; |
103 | 102 |
104 // The delegate. | 103 // The delegate. |
105 UrlPickerDelegate* delegate_; | 104 UrlPickerDelegate* delegate_; |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(UrlPicker); | 106 DISALLOW_COPY_AND_ASSIGN(UrlPicker); |
108 }; | 107 }; |
109 | 108 |
110 #endif // CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_ | 109 #endif // CHROME_BROWSER_UI_VIEWS_URL_PICKER_H_ |
OLD | NEW |