Chromium Code Reviews| Index: chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h |
| diff --git a/chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h b/chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..606f2eb1970999619ce6dcc4b404246132716cf1 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h |
| @@ -0,0 +1,85 @@ |
| +// Copyright 2014 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. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/strings/string16.h" |
| +#include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/common/web_application_info.h" |
| +#include "ui/views/controls/textfield/textfield_controller.h" |
| +#include "ui/views/window/dialog_delegate.h" |
| + |
| +namespace gfx { |
| +class ImageSkia; |
| +} |
| + |
| +namespace views { |
| +class Checkbox; |
| +class ImageView; |
|
msw
2016/04/13 00:54:37
nit: remove
Evan Stade
2016/04/13 20:40:44
Done.
|
| +class LabelButton; |
|
msw
2016/04/13 00:54:37
nit: remove
Evan Stade
2016/04/13 20:40:44
Done.
|
| +class Textfield; |
| +} |
| + |
| +// BookmarkAppConfirmationView is a view intended to be used as the content of a |
| +// Bubble. BookmarkAppConfirmationView provides views for editing the details to |
|
msw
2016/04/13 00:54:37
nit: update mentions of bubble?
Evan Stade
2016/04/13 20:40:44
Done.
|
| +// create a bookmark app with. Don't create a BookmarkAppConfirmationView |
|
msw
2016/04/13 00:54:37
nit: remove last sentence, it's obvious from the p
Evan Stade
2016/04/13 20:40:44
Done.
|
| +// directly, instead use the static ShowBubble method. |
| +class BookmarkAppConfirmationView : public views::DialogDelegateView, |
| + public views::TextfieldController { |
| + public: |
| + ~BookmarkAppConfirmationView() override; |
| + |
| + static void ShowBubble( |
|
msw
2016/04/13 00:54:37
nit: rename ShowDialog or similar?
Evan Stade
2016/04/13 20:40:44
Done.
|
| + gfx::NativeWindow parent, |
| + const WebApplicationInfo& web_app_info, |
| + const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| + |
| + private: |
| + // Creates a BookmarkAppConfirmationView. |
|
msw
2016/04/13 00:54:37
nit: remove
Evan Stade
2016/04/13 20:40:44
Done.
|
| + BookmarkAppConfirmationView( |
| + const WebApplicationInfo& web_app_info, |
| + const BrowserWindow::ShowBookmarkAppBubbleCallback& callback); |
| + |
| + // Overridden from views::WidgetDelegate: |
| + views::View* GetInitiallyFocusedView() override; |
| + base::string16 GetWindowTitle() const override; |
| + bool ShouldShowCloseButton() const override; |
| + void WindowClosing() override; |
| + |
| + // Overriden from views::DialogDelegateView: |
| + views::View* CreateExtraView() override; |
| + bool Accept() override; |
| + bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| + |
| + // Overridden from views::View: |
| + gfx::Size GetMinimumSize() const override; |
| + |
| + // Overridden from views::TextfieldController: |
| + void ContentsChanged(views::Textfield* sender, |
| + const base::string16& new_contents) override; |
| + |
| + // Update the state of the Add button. |
| + void UpdateAddButtonState(); |
| + |
| + // Get the trimmed contents of the title text field. |
| + base::string16 GetTrimmedTitle() const; |
| + |
| + // The WebApplicationInfo that the user is editing. |
| + WebApplicationInfo web_app_info_; |
| + |
| + // The callback to be invoked when the dialog is completed. |
| + BrowserWindow::ShowBookmarkAppBubbleCallback callback_; |
| + |
| + // Checkbox to launch as a window. |
| + views::Checkbox* open_as_window_checkbox_; |
| + |
| + // Textfield showing the title of the app. |
| + views::Textfield* title_tf_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BookmarkAppConfirmationView); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ |