| 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 gfx { |
| 16 class ImageSkia; |
| 17 } |
| 18 |
| 19 namespace views { |
| 20 class Checkbox; |
| 21 class ImageView; |
| 22 class LabelButton; |
| 23 class Textfield; |
| 24 } |
| 25 |
| 26 // BookmarkAppConfirmationView is a view intended to be used as the content of a |
| 27 // Bubble. BookmarkAppConfirmationView provides views for editing the details to |
| 28 // create a bookmark app with. Don't create a BookmarkAppConfirmationView |
| 29 // directly, instead use the static ShowBubble method. |
| 30 class BookmarkAppConfirmationView : public views::DialogDelegateView, |
| 31 public views::TextfieldController { |
| 32 public: |
| 33 ~BookmarkAppConfirmationView() override; |
| 34 |
| 35 static void ShowBubble( |
| 36 gfx::NativeWindow parent, |
| 37 const WebApplicationInfo& web_app_info, |
| 38 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| 39 |
| 40 private: |
| 41 // Creates a BookmarkAppConfirmationView. |
| 42 BookmarkAppConfirmationView( |
| 43 const WebApplicationInfo& web_app_info, |
| 44 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| 45 |
| 46 // Overridden from views::WidgetDelegate: |
| 47 views::View* GetInitiallyFocusedView() override; |
| 48 base::string16 GetWindowTitle() const override; |
| 49 bool ShouldShowCloseButton() const override; |
| 50 void WindowClosing() override; |
| 51 |
| 52 // Overriden from views::DialogDelegateView: |
| 53 views::View* CreateExtraView() override; |
| 54 bool Accept() override; |
| 55 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 56 |
| 57 // Overridden from views::View: |
| 58 gfx::Size GetMinimumSize() const override; |
| 59 |
| 60 // Overridden from views::TextfieldController: |
| 61 void ContentsChanged(views::Textfield* sender, |
| 62 const base::string16& new_contents) override; |
| 63 |
| 64 // Update the state of the Add button. |
| 65 void UpdateAddButtonState(); |
| 66 |
| 67 // Get the trimmed contents of the title text field. |
| 68 base::string16 GetTrimmedTitle() const; |
| 69 |
| 70 // The WebApplicationInfo that the user is editing. |
| 71 WebApplicationInfo web_app_info_; |
| 72 |
| 73 // The callback to be invoked when the dialog is completed. |
| 74 BrowserWindow::ShowBookmarkAppBubbleCallback callback_; |
| 75 |
| 76 // Checkbox to launch as a window. |
| 77 views::Checkbox* open_as_window_checkbox_; |
| 78 |
| 79 // Textfield showing the title of the app. |
| 80 views::Textfield* title_tf_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(BookmarkAppConfirmationView); |
| 83 }; |
| 84 |
| 85 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| OLD | NEW |