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

Side by Side Diff: chrome/browser/first_run/try_chrome_dialog_view.h

Issue 10821007: The new toast experiments. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ 5 #ifndef CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/link_listener.h" 12 #include "ui/views/controls/link_listener.h"
13 13
14 class ProcessSingleton; 14 class ProcessSingleton;
15 15
16 namespace gfx { 16 namespace gfx {
17 class Rect; 17 class Rect;
18 } 18 }
19 19
20 namespace views { 20 namespace views {
21 class RadioButton; 21 class RadioButton;
22 class Checkbox;
22 class Widget; 23 class Widget;
23 } 24 }
24 25
25 // This class displays a modal dialog using the views system. The dialog asks 26 // This class displays a modal dialog using the views system. The dialog asks
26 // the user to give chrome another try. This class only handles the UI so the 27 // the user to give chrome another try. This class only handles the UI so the
27 // resulting actions are up to the caller. One flavor looks like this: 28 // resulting actions are up to the caller. One flavor looks like this:
28 // 29 //
29 // +-----------------------------------------------+ 30 // +-----------------------------------------------+
30 // | |icon| You stopped using Google Chrome [x] | 31 // | |icon| You stopped using Google Chrome [x] |
31 // | |icon| Would you like to: | 32 // | |icon| Would you like to: |
32 // | [o] Give the new version a try | 33 // | [o] Give the new version a try |
33 // | [ ] Uninstall Google Chrome | 34 // | [ ] Uninstall Google Chrome |
34 // | [ OK ] [Don't bug me] | 35 // | [ OK ] [Don't bug me] |
35 // | | 36 // | |
36 // | _why_am_I_seeing this?_ | 37 // | _why_am_I_seeing this?_ |
37 // +-----------------------------------------------+ 38 // +-----------------------------------------------+
Finnur 2012/07/26 12:27:07 Is this diagram still up to date? If not, can you
cpu_(ooo_6.6-7.5) 2012/07/27 03:06:23 The wording has changed but otherwise it is flavor
Finnur 2012/07/29 19:09:44 That's fine. One would have been enough. On 2012/
38 // 39 //
39 class TryChromeDialogView : public views::ButtonListener, 40 class TryChromeDialogView : public views::ButtonListener,
40 public views::LinkListener { 41 public views::LinkListener {
41 public: 42 public:
42 enum Result { 43 enum Result {
43 TRY_CHROME, // Launch chrome right now. 44 TRY_CHROME, // Launch chrome right now.
44 NOT_NOW, // Don't launch chrome. Exit now. 45 TRY_CHROME_AS_DEFAULT, // Launch chrome and make it the default.
45 UNINSTALL_CHROME, // Initiate chrome uninstall and exit. 46 NOT_NOW, // Don't launch chrome. Exit now.
46 DIALOG_ERROR, // An error occurred creating the dialog. 47 UNINSTALL_CHROME, // Initiate chrome uninstall and exit.
48 DIALOG_ERROR, // An error occurred creating the dialog.
47 COUNT 49 COUNT
48 }; 50 };
49 51
50 // Shows a modal dialog asking the user to give chrome another try. See 52 // Shows a modal dialog asking the user to give chrome another try. See
51 // above for the possible outcomes of the function. This is an experimental, 53 // above for the possible outcomes of the function. This is an experimental,
52 // non-localized dialog. 54 // non-localized dialog.
53 // |flavor| can be 0, 1, 2 or 3 and selects what strings to present. 55 // |flavor| can be 0, 1, 2 or 3 and selects what strings to present.
54 // |process_singleton| needs to be valid and it will be locked while 56 // |process_singleton| needs to be valid and it will be locked while
55 // the dialog is shown. 57 // the dialog is shown.
56 // Note that the dialog has no parent and it will position itself in a lower 58 // Note that the dialog has no parent and it will position itself in a lower
57 // corner of the screen. The dialog does not steal focus and does not have an 59 // corner of the screen. The dialog does not steal focus and does not have an
58 // entry in the taskbar. 60 // entry in the taskbar.
59 static Result Show(size_t flavor, ProcessSingleton* process_singleton); 61 static Result Show(size_t flavor, ProcessSingleton* process_singleton);
60 62
61 private: 63 private:
62 enum ButtonTags {
63 BT_NONE,
64 BT_CLOSE_BUTTON,
65 BT_OK_BUTTON,
66 };
67
68 explicit TryChromeDialogView(size_t flavor); 64 explicit TryChromeDialogView(size_t flavor);
69 virtual ~TryChromeDialogView(); 65 virtual ~TryChromeDialogView();
70 66
71 Result ShowModal(ProcessSingleton* process_singleton); 67 Result ShowModal(ProcessSingleton* process_singleton);
72 68
73 // Returns a screen rectangle that is fit to show the window. In particular 69 // Returns a screen rectangle that is fit to show the window. In particular
74 // it has the following properties: a) is visible and b) is attached to the 70 // it has the following properties: a) is visible and b) is attached to the
75 // bottom of the working area. For LTR machines it returns a left side 71 // bottom of the working area. For LTR machines it returns a left side
76 // rectangle and for RTL it returns a right side rectangle so that the dialog 72 // rectangle and for RTL it returns a right side rectangle so that the dialog
77 // does not compete with the standar place of the start menu. 73 // does not compete with the standar place of the start menu.
(...skipping 16 matching lines...) Expand all
94 90
95 // Controls which flavor of the heading text to use. 91 // Controls which flavor of the heading text to use.
96 size_t flavor_; 92 size_t flavor_;
97 93
98 // We don't own any of these pointers. The |popup_| owns itself and owns the 94 // We don't own any of these pointers. The |popup_| owns itself and owns the
99 // other views. 95 // other views.
100 views::Widget* popup_; 96 views::Widget* popup_;
101 views::RadioButton* try_chrome_; 97 views::RadioButton* try_chrome_;
102 views::RadioButton* kill_chrome_; 98 views::RadioButton* kill_chrome_;
103 views::RadioButton* dont_try_chrome_; 99 views::RadioButton* dont_try_chrome_;
100 views::Checkbox* make_default_;
104 Result result_; 101 Result result_;
105 102
106 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView); 103 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView);
107 }; 104 };
108 105
109 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ 106 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/first_run/try_chrome_dialog_view.cc » ('j') | chrome/browser/first_run/try_chrome_dialog_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698