| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 TryChromeDialogView::Result TryChromeDialogView::ShowModal( | 79 TryChromeDialogView::Result TryChromeDialogView::ShowModal( |
| 80 const ActiveModalDialogListener& listener) { | 80 const ActiveModalDialogListener& listener) { |
| 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 82 | 82 |
| 83 views::ImageView* icon = new views::ImageView(); | 83 views::ImageView* icon = new views::ImageView(); |
| 84 icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia()); | 84 icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia()); |
| 85 gfx::Size icon_size = icon->GetPreferredSize(); | 85 gfx::Size icon_size = icon->GetPreferredSize(); |
| 86 | 86 |
| 87 // An approximate window size. After Layout() we'll get better bounds. | 87 // An approximate window size. After Layout() we'll get better bounds. |
| 88 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 88 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 89 params.activatable = views::Widget::InitParams::ACTIVATABLE_YES; | 89 params.can_activate = true; |
| 90 params.bounds = gfx::Rect(310, 200); | 90 params.bounds = gfx::Rect(310, 200); |
| 91 popup_ = new views::Widget; | 91 popup_ = new views::Widget; |
| 92 popup_->Init(params); | 92 popup_->Init(params); |
| 93 | 93 |
| 94 views::View* root_view = popup_->GetRootView(); | 94 views::View* root_view = popup_->GetRootView(); |
| 95 // The window color is a tiny bit off-white. | 95 // The window color is a tiny bit off-white. |
| 96 root_view->set_background( | 96 root_view->set_background( |
| 97 views::Background::CreateSolidBackground(0xfc, 0xfc, 0xfc)); | 97 views::Background::CreateSolidBackground(0xfc, 0xfc, 0xfc)); |
| 98 | 98 |
| 99 views::GridLayout* layout = views::GridLayout::CreatePanel(root_view); | 99 views::GridLayout* layout = views::GridLayout::CreatePanel(root_view); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 result_ = TRY_CHROME_AS_DEFAULT; | 358 result_ = TRY_CHROME_AS_DEFAULT; |
| 359 } | 359 } |
| 360 | 360 |
| 361 popup_->Close(); | 361 popup_->Close(); |
| 362 base::MessageLoop::current()->Quit(); | 362 base::MessageLoop::current()->Quit(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { | 365 void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { |
| 366 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); | 366 ::ShellExecuteW(NULL, L"open", kHelpCenterUrl, NULL, NULL, SW_SHOW); |
| 367 } | 367 } |
| OLD | NEW |