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

Side by Side Diff: chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h

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

Powered by Google App Engine
This is Rietveld 408576698