| 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/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/image_button.h" |
| 14 #include "ui/views/controls/link_listener.h" | 14 #include "ui/views/controls/link_listener.h" |
| 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 Checkbox; |
| 23 class Widget; | 23 class Widget; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 // And the 2013 version looks like: | 48 // And the 2013 version looks like: |
| 49 // +-----------------------------------------------+ | 49 // +-----------------------------------------------+ |
| 50 // | |icon| There is a new version of [x] | | 50 // | |icon| There is a new version of [x] | |
| 51 // | |icon| Google Chrome available | | 51 // | |icon| Google Chrome available | |
| 52 // | [o] Try it out (already installed) | | 52 // | [o] Try it out (already installed) | |
| 53 // | [ ] Don't bug me | | 53 // | [ ] Don't bug me | |
| 54 // | --------------------------------------------- | | 54 // | --------------------------------------------- | |
| 55 // | [x] Make it the default browser [ OK ] | | 55 // | [x] Make it the default browser [ OK ] | |
| 56 // +-----------------------------------------------+ | 56 // +-----------------------------------------------+ |
| 57 | 57 |
| 58 class TryChromeDialogView : public views::ButtonListener, | 58 class TryChromeDialogView : public views::ImageButtonDelegate, |
| 59 public views::LinkListener { | 59 public views::LinkListener { |
| 60 public: | 60 public: |
| 61 // Receives a handle to the active modal dialog, or NULL when the active | 61 // Receives a handle to the active modal dialog, or NULL when the active |
| 62 // dialog is dismissed. | 62 // dialog is dismissed. |
| 63 typedef base::Callback<void(gfx::NativeWindow active_dialog)> | 63 typedef base::Callback<void(gfx::NativeWindow active_dialog)> |
| 64 ActiveModalDialogListener; | 64 ActiveModalDialogListener; |
| 65 | 65 |
| 66 enum Result { | 66 enum Result { |
| 67 TRY_CHROME, // Launch chrome right now. | 67 TRY_CHROME, // Launch chrome right now. |
| 68 TRY_CHROME_AS_DEFAULT, // Launch chrome and make it the default. | 68 TRY_CHROME_AS_DEFAULT, // Launch chrome and make it the default. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 93 // it has the following properties: a) is visible and b) is attached to the | 93 // 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 | 94 // 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 | 95 // 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. | 96 // does not compete with the standar place of the start menu. |
| 97 gfx::Rect ComputeWindowPosition(int width, int height, bool is_RTL); | 97 gfx::Rect ComputeWindowPosition(int width, int height, bool is_RTL); |
| 98 | 98 |
| 99 // Create a windows region that looks like a toast of width |w| and height | 99 // 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. | 100 // |h|. This is best effort, so we don't care much if the operation fails. |
| 101 void SetToastRegion(HWND window, int w, int h); | 101 void SetToastRegion(HWND window, int w, int h); |
| 102 | 102 |
| 103 // views::ButtonListener: | 103 // views::ImageButtonDelegate: |
| 104 // We have two buttons and according to what the user clicked we set |result_| | 104 // 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. | 105 // and we should always close and end the modal loop. |
| 106 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 106 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 107 | 107 |
| 108 // views::LinkListener: | 108 // views::LinkListener: |
| 109 // If the user selects the link we need to fire off the default browser that | 109 // If the user selects the link we need to fire off the default browser that |
| 110 // by some convoluted logic should not be chrome. | 110 // by some convoluted logic should not be chrome. |
| 111 void LinkClicked(views::Link* source, int event_flags) override; | 111 void LinkClicked(views::Link* source, int event_flags) override; |
| 112 | 112 |
| 113 // Controls which flavor of the heading text to use. | 113 // Controls which flavor of the heading text to use. |
| 114 size_t flavor_; | 114 size_t flavor_; |
| 115 | 115 |
| 116 // We don't own any of these pointers. The |popup_| owns itself and owns the | 116 // We don't own any of these pointers. The |popup_| owns itself and owns the |
| 117 // other views. | 117 // other views. |
| 118 views::Widget* popup_; | 118 views::Widget* popup_; |
| 119 views::RadioButton* try_chrome_; | 119 views::RadioButton* try_chrome_; |
| 120 views::RadioButton* kill_chrome_; | 120 views::RadioButton* kill_chrome_; |
| 121 views::RadioButton* dont_try_chrome_; | 121 views::RadioButton* dont_try_chrome_; |
| 122 views::Checkbox* make_default_; | 122 views::Checkbox* make_default_; |
| 123 Result result_; | 123 Result result_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView); | 125 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ | 128 #endif // CHROME_BROWSER_FIRST_RUN_TRY_CHROME_DIALOG_VIEW_H_ |
| OLD | NEW |