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 aura::client::DispatcherRunLoop run_loop(client, NULL); |
| 70 dialog->quit_runloop_ = run_loop.QuitClosure(); |
| 71 run_loop.Run(); |
70 dialog_shown = true; | 72 dialog_shown = true; |
71 } | 73 } |
72 #endif // defined(GOOGLE_CHROME_BUILD) | 74 #endif // defined(GOOGLE_CHROME_BUILD) |
73 | 75 |
74 return dialog_shown; | 76 return dialog_shown; |
75 } | 77 } |
76 | 78 |
77 FirstRunDialog::FirstRunDialog(Profile* profile) | 79 FirstRunDialog::FirstRunDialog(Profile* profile) |
78 : profile_(profile), | 80 : profile_(profile), |
79 make_default_(NULL), | 81 make_default_(NULL), |
(...skipping 16 matching lines...) Expand all Loading... |
96 layout->StartRowWithPadding(0, 0, 0, related_y); | 98 layout->StartRowWithPadding(0, 0, 0, related_y); |
97 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( | 99 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( |
98 IDS_OPTIONS_ENABLE_LOGGING)); | 100 IDS_OPTIONS_ENABLE_LOGGING)); |
99 layout->AddView(report_crashes_); | 101 layout->AddView(report_crashes_); |
100 } | 102 } |
101 | 103 |
102 FirstRunDialog::~FirstRunDialog() { | 104 FirstRunDialog::~FirstRunDialog() { |
103 } | 105 } |
104 | 106 |
105 void FirstRunDialog::Done() { | 107 void FirstRunDialog::Done() { |
106 aura::Window* window = GetWidget()->GetNativeView(); | 108 CHECK(!quit_runloop_.is_null()); |
107 aura::client::DispatcherClient* client = | 109 quit_runloop_.Run(); |
108 aura::client::GetDispatcherClient(window->GetRootWindow()); | |
109 client->QuitNestedMessageLoop(); | |
110 } | 110 } |
111 | 111 |
112 views::View* FirstRunDialog::CreateExtraView() { | 112 views::View* FirstRunDialog::CreateExtraView() { |
113 views::Link* link = new views::Link(l10n_util::GetStringUTF16( | 113 views::Link* link = new views::Link(l10n_util::GetStringUTF16( |
114 IDS_LEARN_MORE)); | 114 IDS_LEARN_MORE)); |
115 link->set_listener(this); | 115 link->set_listener(this); |
116 return link; | 116 return link; |
117 } | 117 } |
118 | 118 |
119 void FirstRunDialog::OnClosed() { | 119 void FirstRunDialog::OnClosed() { |
(...skipping 18 matching lines...) Expand all Loading... |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 int FirstRunDialog::GetDialogButtons() const { | 141 int FirstRunDialog::GetDialogButtons() const { |
142 return ui::DIALOG_BUTTON_OK; | 142 return ui::DIALOG_BUTTON_OK; |
143 } | 143 } |
144 | 144 |
145 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { | 145 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { |
146 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); | 146 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); |
147 } | 147 } |
OLD | NEW |