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 #include "chrome/browser/first_run/try_chrome_dialog_view.h" | 5 #include "chrome/browser/first_run/try_chrome_dialog_view.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "chrome/browser/process_singleton.h" | 14 #include "chrome/browser/process_singleton.h" |
14 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
17 #include "chrome/installer/util/user_experiment.h" | 18 #include "chrome/installer/util/user_experiment.h" |
18 #include "grit/components_strings.h" | 19 #include "grit/components_strings.h" |
19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
20 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
21 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 // Carve the toast shape into the window. | 283 // Carve the toast shape into the window. |
283 HWND toast_window; | 284 HWND toast_window; |
284 toast_window = popup_->GetNativeView()->GetHost()->GetAcceleratedWidget(); | 285 toast_window = popup_->GetNativeView()->GetHost()->GetAcceleratedWidget(); |
285 SetToastRegion(toast_window, preferred.width(), preferred.height()); | 286 SetToastRegion(toast_window, preferred.width(), preferred.height()); |
286 | 287 |
287 // Time to show the window in a modal loop. | 288 // Time to show the window in a modal loop. |
288 popup_->Show(); | 289 popup_->Show(); |
289 if (!listener.is_null()) | 290 if (!listener.is_null()) |
290 listener.Run(popup_->GetNativeView()); | 291 listener.Run(popup_->GetNativeView()); |
291 base::MessageLoop::current()->Run(); | 292 base::RunLoop().Run(); |
292 if (!listener.is_null()) | 293 if (!listener.is_null()) |
293 listener.Run(NULL); | 294 listener.Run(NULL); |
294 return result_; | 295 return result_; |
295 } | 296 } |
296 | 297 |
297 gfx::Rect TryChromeDialogView::ComputeWindowPosition(int width, | 298 gfx::Rect TryChromeDialogView::ComputeWindowPosition(int width, |
298 int height, | 299 int height, |
299 bool is_RTL) { | 300 bool is_RTL) { |
300 // The 'Shell_TrayWnd' is the taskbar. We like to show our window in that | 301 // The 'Shell_TrayWnd' is the taskbar. We like to show our window in that |
301 // monitor if we can. This code works even if such window is not found. | 302 // monitor if we can. This code works even if such window is not found. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 result_ = TRY_CHROME_AS_DEFAULT; | 361 result_ = TRY_CHROME_AS_DEFAULT; |
361 } | 362 } |
362 | 363 |
363 popup_->Close(); | 364 popup_->Close(); |
364 base::MessageLoop::current()->QuitWhenIdle(); | 365 base::MessageLoop::current()->QuitWhenIdle(); |
365 } | 366 } |
366 | 367 |
367 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { | 368 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { |
368 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); | 369 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); |
369 } | 370 } |
OLD | NEW |