| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/controls/link_listener.h" | 16 #include "ui/views/controls/link_listener.h" |
| 15 | 17 |
| 16 namespace gfx { | |
| 17 class Rect; | |
| 18 } | |
| 19 | |
| 20 namespace views { | 18 namespace views { |
| 21 class RadioButton; | 19 class RadioButton; |
| 22 class Checkbox; | 20 class Checkbox; |
| 23 class Widget; | 21 class Widget; |
| 24 } | 22 } |
| 25 | 23 |
| 26 // This class displays a modal dialog using the views system. The dialog asks | 24 // This class displays a modal dialog using the views system. The dialog asks |
| 27 // the user to give chrome another try. This class only handles the UI so the | 25 // the user to give chrome another try. This class only handles the UI so the |
| 28 // resulting actions are up to the caller. One flavor looks like this: | 26 // resulting actions are up to the caller. One flavor looks like this: |
| 29 // | 27 // |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 private: | 84 private: |
| 87 explicit TryChromeDialogView(size_t flavor); | 85 explicit TryChromeDialogView(size_t flavor); |
| 88 ~TryChromeDialogView() override; | 86 ~TryChromeDialogView() override; |
| 89 | 87 |
| 90 Result ShowModal(const ActiveModalDialogListener& listener); | 88 Result ShowModal(const ActiveModalDialogListener& listener); |
| 91 | 89 |
| 92 // Returns a screen rectangle that is fit to show the window. In particular | 90 // Returns a screen rectangle that is fit to show the window. In particular |
| 93 // it has the following properties: a) is visible and b) is attached to the | 91 // it has the following properties: a) is visible and b) is attached to the |
| 94 // bottom of the working area. For LTR machines it returns a left side | 92 // bottom of the working area. For LTR machines it returns a left side |
| 95 // rectangle and for RTL it returns a right side rectangle so that the dialog | 93 // rectangle and for RTL it returns a right side rectangle so that the dialog |
| 96 // does not compete with the standar place of the start menu. | 94 // does not compete with the standard place of the start menu. |
| 97 gfx::Rect ComputeWindowPosition(int width, int height, bool is_RTL); | 95 gfx::Rect ComputeWindowPosition(gfx::Size size, bool is_RTL); |
| 98 | 96 |
| 99 // Create a windows region that looks like a toast of width |w| and height | 97 // Create a windows region that looks like a toast of width |w| and height |
| 100 // |h|. This is best effort, so we don't care much if the operation fails. | 98 // |h|. This is best effort, so we don't care much if the operation fails. |
| 101 void SetToastRegion(HWND window, int w, int h); | 99 void SetToastRegion(HWND window, int w, int h); |
| 102 | 100 |
| 103 // views::ButtonListener: | 101 // views::ButtonListener: |
| 104 // We have two buttons and according to what the user clicked we set |result_| | 102 // We have two buttons and according to what the user clicked we set |result_| |
| 105 // and we should always close and end the modal loop. | 103 // and we should always close and end the modal loop. |
| 106 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 104 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 107 | 105 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 119 views::RadioButton* try_chrome_; | 117 views::RadioButton* try_chrome_; |
| 120 views::RadioButton* kill_chrome_; | 118 views::RadioButton* kill_chrome_; |
| 121 views::RadioButton* dont_try_chrome_; | 119 views::RadioButton* dont_try_chrome_; |
| 122 views::Checkbox* make_default_; | 120 views::Checkbox* make_default_; |
| 123 Result result_; | 121 Result result_; |
| 124 | 122 |
| 125 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView); | 123 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView); |
| 126 }; | 124 }; |
| 127 | 125 |
| 128 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ | 126 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ |
| OLD | NEW |