| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" |
| 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/common/web_application_info.h" |
| 12 #include "ui/views/controls/textfield/textfield_controller.h" |
| 13 #include "ui/views/window/dialog_delegate.h" |
| 14 |
| 15 namespace views { |
| 16 class Checkbox; |
| 17 class Textfield; |
| 18 } |
| 19 |
| 20 // BookmarkAppConfirmationView provides views for editing the details to |
| 21 // create a bookmark app with. (More tools > Add to desktop) |
| 22 class BookmarkAppConfirmationView : public views::DialogDelegateView, |
| 23 public views::TextfieldController { |
| 24 public: |
| 25 ~BookmarkAppConfirmationView() override; |
| 26 |
| 27 static void CreateAndShow( |
| 28 gfx::NativeWindow parent, |
| 29 const WebApplicationInfo& web_app_info, |
| 30 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| 31 |
| 32 private: |
| 33 BookmarkAppConfirmationView( |
| 34 const WebApplicationInfo& web_app_info, |
| 35 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| 36 |
| 37 // Overridden from views::WidgetDelegate: |
| 38 views::View* GetInitiallyFocusedView() override; |
| 39 base::string16 GetWindowTitle() const override; |
| 40 bool ShouldShowCloseButton() const override; |
| 41 void WindowClosing() override; |
| 42 |
| 43 // Overriden from views::DialogDelegateView: |
| 44 views::View* CreateExtraView() override; |
| 45 bool Accept() override; |
| 46 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 47 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 48 |
| 49 // Overridden from views::View: |
| 50 gfx::Size GetMinimumSize() const override; |
| 51 |
| 52 // Overridden from views::TextfieldController: |
| 53 void ContentsChanged(views::Textfield* sender, |
| 54 const base::string16& new_contents) override; |
| 55 |
| 56 // Update the state of the Add button. |
| 57 void UpdateAddButtonState(); |
| 58 |
| 59 // Get the trimmed contents of the title text field. |
| 60 base::string16 GetTrimmedTitle() const; |
| 61 |
| 62 // The WebApplicationInfo that the user is editing. |
| 63 WebApplicationInfo web_app_info_; |
| 64 |
| 65 // The callback to be invoked when the dialog is completed. |
| 66 BrowserWindow::ShowBookmarkAppBubbleCallback callback_; |
| 67 |
| 68 // Checkbox to launch as a window. |
| 69 views::Checkbox* open_as_window_checkbox_; |
| 70 |
| 71 // Textfield showing the title of the app. |
| 72 views::Textfield* title_tf_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(BookmarkAppConfirmationView); |
| 75 }; |
| 76 |
| 77 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| OLD | NEW |