OLD | NEW |
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 #include "chrome/browser/ui/views/first_run_dialog.h" | 5 #include "chrome/browser/ui/views/first_run_dialog.h" |
6 | 6 |
7 #include "chrome/browser/first_run/first_run.h" | 7 #include "chrome/browser/first_run/first_run.h" |
8 #include "chrome/browser/platform_util.h" | 8 #include "chrome/browser/platform_util.h" |
9 #include "chrome/browser/shell_integration.h" | 9 #include "chrome/browser/shell_integration.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // Use the widget's window itself so that the message loop | 60 // Use the widget's window itself so that the message loop |
61 // exists when the dialog is closed by some other means than | 61 // exists when the dialog is closed by some other means than |
62 // |Accept|. | 62 // |Accept|. |
63 // | 63 // |
64 // This is the same trick used in simple_message_box_views.cc, minus the | 64 // This is the same trick used in simple_message_box_views.cc, minus the |
65 // refcounting. | 65 // refcounting. |
66 aura::Window* anchor = dialog->GetWidget()->GetNativeWindow(); | 66 aura::Window* anchor = dialog->GetWidget()->GetNativeWindow(); |
67 aura::client::DispatcherClient* client = | 67 aura::client::DispatcherClient* client = |
68 aura::client::GetDispatcherClient(anchor->GetRootWindow()); | 68 aura::client::GetDispatcherClient(anchor->GetRootWindow()); |
69 client->RunWithDispatcher(NULL); | 69 client->RunWithDispatcher(NULL, &quit_runloop_); |
70 dialog_shown = true; | 70 dialog_shown = true; |
71 } | 71 } |
72 #endif // defined(GOOGLE_CHROME_BUILD) | 72 #endif // defined(GOOGLE_CHROME_BUILD) |
73 | 73 |
74 return dialog_shown; | 74 return dialog_shown; |
75 } | 75 } |
76 | 76 |
77 FirstRunDialog::FirstRunDialog(Profile* profile) | 77 FirstRunDialog::FirstRunDialog(Profile* profile) |
78 : profile_(profile), | 78 : profile_(profile), |
79 make_default_(NULL), | 79 make_default_(NULL), |
(...skipping 16 matching lines...) Expand all Loading... |
96 layout->StartRowWithPadding(0, 0, 0, related_y); | 96 layout->StartRowWithPadding(0, 0, 0, related_y); |
97 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( | 97 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( |
98 IDS_OPTIONS_ENABLE_LOGGING)); | 98 IDS_OPTIONS_ENABLE_LOGGING)); |
99 layout->AddView(report_crashes_); | 99 layout->AddView(report_crashes_); |
100 } | 100 } |
101 | 101 |
102 FirstRunDialog::~FirstRunDialog() { | 102 FirstRunDialog::~FirstRunDialog() { |
103 } | 103 } |
104 | 104 |
105 void FirstRunDialog::Done() { | 105 void FirstRunDialog::Done() { |
106 aura::Window* window = GetWidget()->GetNativeView(); | 106 CHECK(!quit_runloop_.is_null()); |
107 aura::client::DispatcherClient* client = | 107 quit_runloop_.Run(); |
108 aura::client::GetDispatcherClient(window->GetRootWindow()); | |
109 client->QuitNestedMessageLoop(); | |
110 } | 108 } |
111 | 109 |
112 views::View* FirstRunDialog::CreateExtraView() { | 110 views::View* FirstRunDialog::CreateExtraView() { |
113 views::Link* link = new views::Link(l10n_util::GetStringUTF16( | 111 views::Link* link = new views::Link(l10n_util::GetStringUTF16( |
114 IDS_LEARN_MORE)); | 112 IDS_LEARN_MORE)); |
115 link->set_listener(this); | 113 link->set_listener(this); |
116 return link; | 114 return link; |
117 } | 115 } |
118 | 116 |
119 void FirstRunDialog::OnClosed() { | 117 void FirstRunDialog::OnClosed() { |
(...skipping 18 matching lines...) Expand all Loading... |
138 return true; | 136 return true; |
139 } | 137 } |
140 | 138 |
141 int FirstRunDialog::GetDialogButtons() const { | 139 int FirstRunDialog::GetDialogButtons() const { |
142 return ui::DIALOG_BUTTON_OK; | 140 return ui::DIALOG_BUTTON_OK; |
143 } | 141 } |
144 | 142 |
145 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { | 143 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { |
146 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); | 144 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); |
147 } | 145 } |
OLD | NEW |