Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1499)

Unified Diff: chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h

Issue 1878963003: Convert BookmarkBubbleAppView to a DialogDelegateView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d457f20d11ce15d18c42ddc4c94d4588a0955b24
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h
@@ -0,0 +1,77 @@
+// 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 views {
+class Checkbox;
+class Textfield;
+}
+
+// BookmarkAppConfirmationView provides views for editing the details to
+// create a bookmark app with. (More tools > Add to desktop)
+class BookmarkAppConfirmationView : public views::DialogDelegateView,
+ public views::TextfieldController {
+ public:
+ ~BookmarkAppConfirmationView() override;
+
+ static void CreateAndShow(
+ gfx::NativeWindow parent,
+ const WebApplicationInfo& web_app_info,
+ const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
+
+ private:
+ 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;
+ base::string16 GetDialogButtonLabel(ui::DialogButton button) const 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_

Powered by Google App Engine
This is Rietveld 408576698