| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_SHELF_ITEM_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_SHELF_ITEM_DIALOG_H_ |
| 6 #define CHROME_BROWSER_VIEWS_SHELF_ITEM_DIALOG_H_ | 6 #define CHROME_BROWSER_VIEWS_SHELF_ITEM_DIALOG_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/cancelable_request.h" | 8 #include "chrome/browser/cancelable_request.h" |
| 9 #include "chrome/browser/history/history.h" | 9 #include "chrome/browser/history/history.h" |
| 10 #include "views/controls/button/native_button.h" | 10 #include "views/controls/button/native_button.h" |
| 11 #include "views/controls/table/table_view.h" | 11 #include "views/controls/table/table_view.h" |
| 12 #include "views/controls/text_field.h" | 12 #include "views/controls/textfield/textfield.h" |
| 13 #include "views/view.h" | 13 #include "views/view.h" |
| 14 #include "views/window/dialog_delegate.h" | 14 #include "views/window/dialog_delegate.h" |
| 15 #include "views/window/window.h" | 15 #include "views/window/window.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class Button; | 18 class Button; |
| 19 class Label; | 19 class Label; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class PossibleURLModel; | 22 class PossibleURLModel; |
| (...skipping 12 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 // ShelfItemDialog deletes itself when the dialog is closed. | 40 // ShelfItemDialog deletes itself when the dialog is closed. |
| 41 // | 41 // |
| 42 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 43 class ShelfItemDialog : public views::View, | 43 class ShelfItemDialog : public views::View, |
| 44 public views::DialogDelegate, | 44 public views::DialogDelegate, |
| 45 public views::TextField::Controller, | 45 public views::Textfield::Controller, |
| 46 public views::TableViewObserver { | 46 public views::TableViewObserver { |
| 47 public: | 47 public: |
| 48 ShelfItemDialog(ShelfItemDialogDelegate* delegate, | 48 ShelfItemDialog(ShelfItemDialogDelegate* delegate, |
| 49 Profile* profile, | 49 Profile* profile, |
| 50 bool show_title); | 50 bool show_title); |
| 51 virtual ~ShelfItemDialog(); | 51 virtual ~ShelfItemDialog(); |
| 52 | 52 |
| 53 // Show the dialog on the provided contents. | 53 // Show the dialog on the provided contents. |
| 54 virtual void Show(HWND parent); | 54 virtual void Show(HWND parent); |
| 55 | 55 |
| 56 // Closes the dialog. | 56 // Closes the dialog. |
| 57 void Close(); | 57 void Close(); |
| 58 | 58 |
| 59 // DialogDelegate. | 59 // DialogDelegate. |
| 60 virtual std::wstring GetWindowTitle() const; | 60 virtual std::wstring GetWindowTitle() const; |
| 61 virtual bool IsModal() const; | 61 virtual bool IsModal() const; |
| 62 virtual std::wstring GetDialogButtonLabel( | 62 virtual std::wstring GetDialogButtonLabel( |
| 63 MessageBoxFlags::DialogButton button) const; | 63 MessageBoxFlags::DialogButton button) const; |
| 64 virtual bool Accept(); | 64 virtual bool Accept(); |
| 65 virtual bool IsDialogButtonEnabled(MessageBoxFlags::DialogButton button) const
; | 65 virtual bool IsDialogButtonEnabled(MessageBoxFlags::DialogButton button) const
; |
| 66 virtual views::View* GetContentsView(); | 66 virtual views::View* GetContentsView(); |
| 67 | 67 |
| 68 // TextField::Controller. | 68 // TextField::Controller. |
| 69 virtual void ContentsChanged(views::TextField* sender, | 69 virtual void ContentsChanged(views::Textfield* sender, |
| 70 const std::wstring& new_contents); | 70 const std::wstring& new_contents); |
| 71 virtual bool HandleKeystroke(views::TextField* sender, | 71 virtual bool HandleKeystroke(views::Textfield* sender, |
| 72 const views::TextField::Keystroke& key) { | 72 const views::Textfield::Keystroke& key) { |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Overridden from View. | 76 // Overridden from View. |
| 77 virtual gfx::Size GetPreferredSize(); | 77 virtual gfx::Size GetPreferredSize(); |
| 78 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 78 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| 79 | 79 |
| 80 // TableViewObserver. | 80 // TableViewObserver. |
| 81 virtual void OnSelectionChanged(); | 81 virtual void OnSelectionChanged(); |
| 82 virtual void OnDoubleClick(); | 82 virtual void OnDoubleClick(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 const history::URLRow* info, | 95 const history::URLRow* info, |
| 96 history::VisitVector* unused); | 96 history::VisitVector* unused); |
| 97 | 97 |
| 98 // Returns the URL the user has typed. | 98 // Returns the URL the user has typed. |
| 99 GURL GetInputURL() const; | 99 GURL GetInputURL() const; |
| 100 | 100 |
| 101 // Profile. | 101 // Profile. |
| 102 Profile* profile_; | 102 Profile* profile_; |
| 103 | 103 |
| 104 // URL Field. | 104 // URL Field. |
| 105 views::TextField* url_field_; | 105 views::Textfield* url_field_; |
| 106 | 106 |
| 107 // Title field. This is NULL if we're not showing the title. | 107 // Title field. This is NULL if we're not showing the title. |
| 108 views::TextField* title_field_; | 108 views::Textfield* title_field_; |
| 109 | 109 |
| 110 // The table model. | 110 // The table model. |
| 111 scoped_ptr<PossibleURLModel> url_table_model_; | 111 scoped_ptr<PossibleURLModel> url_table_model_; |
| 112 | 112 |
| 113 // The table of visited urls. | 113 // The table of visited urls. |
| 114 views::TableView* url_table_; | 114 views::TableView* url_table_; |
| 115 | 115 |
| 116 // Handle of the title request we are expecting. | 116 // Handle of the title request we are expecting. |
| 117 CancelableRequestProvider::Handle expected_title_handle_; | 117 CancelableRequestProvider::Handle expected_title_handle_; |
| 118 | 118 |
| 119 // The consumer object for the history database. | 119 // The consumer object for the history database. |
| 120 CancelableRequestConsumer history_consumer_; | 120 CancelableRequestConsumer history_consumer_; |
| 121 | 121 |
| 122 // The delegate. | 122 // The delegate. |
| 123 ShelfItemDialogDelegate* delegate_; | 123 ShelfItemDialogDelegate* delegate_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(ShelfItemDialog); | 125 DISALLOW_COPY_AND_ASSIGN(ShelfItemDialog); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif // CHROME_BROWSER_VIEWS_SHELF_ITEM_DIALOG_H_ | 128 #endif // CHROME_BROWSER_VIEWS_SHELF_ITEM_DIALOG_H_ |
| OLD | NEW |