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

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: using, OnceCallback 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(const WebApplicationInfo& web_app_info,
26 chrome::ShowBookmarkAppDialogCallback callback);
25 ~BookmarkAppConfirmationView() override; 27 ~BookmarkAppConfirmationView() override;
26 28
27 static void CreateAndShow(
28 gfx::NativeWindow parent,
29 const WebApplicationInfo& web_app_info,
30 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
31
32 private: 29 private:
33 BookmarkAppConfirmationView(
34 const WebApplicationInfo& web_app_info,
35 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback);
36
37 // Overridden from views::WidgetDelegate: 30 // Overridden from views::WidgetDelegate:
38 views::View* GetInitiallyFocusedView() override; 31 views::View* GetInitiallyFocusedView() override;
39 ui::ModalType GetModalType() const override; 32 ui::ModalType GetModalType() const override;
40 base::string16 GetWindowTitle() const override; 33 base::string16 GetWindowTitle() const override;
41 bool ShouldShowCloseButton() const override; 34 bool ShouldShowCloseButton() const override;
42 void WindowClosing() override; 35 void WindowClosing() override;
43 36
44 // Overriden from views::DialogDelegateView: 37 // Overriden from views::DialogDelegateView:
45 bool Accept() override; 38 bool Accept() override;
46 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 39 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
47 bool IsDialogButtonEnabled(ui::DialogButton button) const override; 40 bool IsDialogButtonEnabled(ui::DialogButton button) const override;
48 41
49 // Overridden from views::View: 42 // Overridden from views::View:
50 gfx::Size GetMinimumSize() const override; 43 gfx::Size GetMinimumSize() const override;
51 44
52 // Overridden from views::TextfieldController: 45 // Overridden from views::TextfieldController:
53 void ContentsChanged(views::Textfield* sender, 46 void ContentsChanged(views::Textfield* sender,
54 const base::string16& new_contents) override; 47 const base::string16& new_contents) override;
55 48
56 // Update the state of the Add button. 49 // Update the state of the Add button.
57 void UpdateAddButtonState(); 50 void UpdateAddButtonState();
58 51
59 // Get the trimmed contents of the title text field. 52 // Get the trimmed contents of the title text field.
60 base::string16 GetTrimmedTitle() const; 53 base::string16 GetTrimmedTitle() const;
61 54
62 // The WebApplicationInfo that the user is editing. 55 // The WebApplicationInfo that the user is editing.
63 WebApplicationInfo web_app_info_; 56 WebApplicationInfo web_app_info_;
64 57
65 // The callback to be invoked when the dialog is completed. 58 // The callback to be invoked when the dialog is completed.
66 BrowserWindow::ShowBookmarkAppBubbleCallback callback_; 59 chrome::ShowBookmarkAppDialogCallback callback_;
67 60
68 // Checkbox to launch as a window. 61 // Checkbox to launch as a window.
69 views::Checkbox* open_as_window_checkbox_; 62 views::Checkbox* open_as_window_checkbox_;
70 63
71 // Textfield showing the title of the app. 64 // Textfield showing the title of the app.
72 views::Textfield* title_tf_; 65 views::Textfield* title_tf_;
73 66
74 DISALLOW_COPY_AND_ASSIGN(BookmarkAppConfirmationView); 67 DISALLOW_COPY_AND_ASSIGN(BookmarkAppConfirmationView);
75 }; 68 };
76 69
77 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_ 70 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BOOKMARK_APP_CONFIRMATION_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698