Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/first_run/try_chrome_dialog_view.cc

Issue 246633004: Remove non USE_AURA code from views files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT and throw away conflicting files; I'll redo them in another patch. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "chrome/browser/process_singleton.h" 12 #include "chrome/browser/process_singleton.h"
13 #include "chrome/installer/util/browser_distribution.h" 13 #include "chrome/installer/util/browser_distribution.h"
14 #include "chrome/installer/util/user_experiment.h" 14 #include "chrome/installer/util/user_experiment.h"
15 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
18 #include "grit/ui_resources.h" 18 #include "grit/ui_resources.h"
19 #include "ui/aura/window.h"
20 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
22 #include "ui/views/background.h" 24 #include "ui/views/background.h"
23 #include "ui/views/controls/button/checkbox.h" 25 #include "ui/views/controls/button/checkbox.h"
24 #include "ui/views/controls/button/image_button.h" 26 #include "ui/views/controls/button/image_button.h"
25 #include "ui/views/controls/button/label_button.h" 27 #include "ui/views/controls/button/label_button.h"
26 #include "ui/views/controls/button/radio_button.h" 28 #include "ui/views/controls/button/radio_button.h"
27 #include "ui/views/controls/image_view.h" 29 #include "ui/views/controls/image_view.h"
28 #include "ui/views/controls/link.h" 30 #include "ui/views/controls/link.h"
29 #include "ui/views/controls/separator.h" 31 #include "ui/views/controls/separator.h"
30 #include "ui/views/layout/grid_layout.h" 32 #include "ui/views/layout/grid_layout.h"
31 #include "ui/views/layout/layout_constants.h" 33 #include "ui/views/layout/layout_constants.h"
32 #include "ui/views/widget/widget.h" 34 #include "ui/views/widget/widget.h"
33 35
34 #if defined(USE_AURA)
35 #include "ui/aura/window.h"
36 #include "ui/aura/window_tree_host.h"
37 #endif
38
39 namespace { 36 namespace {
40 37
41 const wchar_t kHelpCenterUrl[] = 38 const wchar_t kHelpCenterUrl[] =
42 L"https://www.google.com/support/chrome/bin/answer.py?answer=150752"; 39 L"https://www.google.com/support/chrome/bin/answer.py?answer=150752";
43 40
44 enum ButtonTags { 41 enum ButtonTags {
45 BT_NONE, 42 BT_NONE,
46 BT_CLOSE_BUTTON, 43 BT_CLOSE_BUTTON,
47 BT_OK_BUTTON, 44 BT_OK_BUTTON,
48 BT_TRY_IT_RADIO, 45 BT_TRY_IT_RADIO,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 int separator_height = separator->GetPreferredSize().height(); 272 int separator_height = separator->GetPreferredSize().height();
276 separator->SetSize(gfx::Size(preferred.width(), separator_height)); 273 separator->SetSize(gfx::Size(preferred.width(), separator_height));
277 } 274 }
278 275
279 gfx::Rect pos = ComputeWindowPosition(preferred.width(), preferred.height(), 276 gfx::Rect pos = ComputeWindowPosition(preferred.width(), preferred.height(),
280 base::i18n::IsRTL()); 277 base::i18n::IsRTL());
281 popup_->SetBounds(pos); 278 popup_->SetBounds(pos);
282 279
283 // Carve the toast shape into the window. 280 // Carve the toast shape into the window.
284 HWND toast_window; 281 HWND toast_window;
285 #if defined(USE_AURA)
286 toast_window = popup_->GetNativeView()->GetHost()->GetAcceleratedWidget(); 282 toast_window = popup_->GetNativeView()->GetHost()->GetAcceleratedWidget();
287 #else
288 toast_window = popup_->GetNativeView();
289 #endif
290 SetToastRegion(toast_window, preferred.width(), preferred.height()); 283 SetToastRegion(toast_window, preferred.width(), preferred.height());
291 284
292 // Time to show the window in a modal loop. 285 // Time to show the window in a modal loop.
293 popup_->Show(); 286 popup_->Show();
294 if (!listener.is_null()) 287 if (!listener.is_null())
295 listener.Run(popup_->GetNativeView()); 288 listener.Run(popup_->GetNativeView());
296 base::MessageLoop::current()->Run(); 289 base::MessageLoop::current()->Run();
297 if (!listener.is_null()) 290 if (!listener.is_null())
298 listener.Run(NULL); 291 listener.Run(NULL);
299 return result_; 292 return result_;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 result_ = TRY_CHROME_AS_DEFAULT; 358 result_ = TRY_CHROME_AS_DEFAULT;
366 } 359 }
367 360
368 popup_->Close(); 361 popup_->Close();
369 base::MessageLoop::current()->Quit(); 362 base::MessageLoop::current()->Quit();
370 } 363 }
371 364
372 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { 365 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) {
373 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); 366 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW);
374 } 367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698