| 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/ui/views/create_application_shortcut_view.h" | 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/constrained_window/constrained_window_views.h" | 15 #include "components/constrained_window/constrained_window_views.h" |
| 15 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 16 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 18 #include "ui/views/controls/button/checkbox.h" | 19 #include "ui/views/controls/button/checkbox.h" |
| 19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| 20 #include "ui/views/layout/grid_layout.h" | 21 #include "ui/views/layout/grid_layout.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 menu_check_box_(nullptr), | 52 menu_check_box_(nullptr), |
| 52 quick_launch_check_box_(nullptr), | 53 quick_launch_check_box_(nullptr), |
| 53 weak_ptr_factory_(this) { | 54 weak_ptr_factory_(this) { |
| 54 InitControls(); | 55 InitControls(); |
| 55 | 56 |
| 56 // Get shortcut and icon information; needed for creating the shortcut. | 57 // Get shortcut and icon information; needed for creating the shortcut. |
| 57 web_app::GetShortcutInfoForApp( | 58 web_app::GetShortcutInfoForApp( |
| 58 app, profile, | 59 app, profile, |
| 59 base::Bind(&CreateChromeApplicationShortcutView::OnAppInfoLoaded, | 60 base::Bind(&CreateChromeApplicationShortcutView::OnAppInfoLoaded, |
| 60 weak_ptr_factory_.GetWeakPtr())); | 61 weak_ptr_factory_.GetWeakPtr())); |
| 62 chrome::RecordDialogCreation( |
| 63 chrome::DialogIdentifier::CREATE_CHROME_APPLICATION_SHORTCUT); |
| 61 } | 64 } |
| 62 | 65 |
| 63 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} | 66 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |
| 64 | 67 |
| 65 void CreateChromeApplicationShortcutView::InitControls() { | 68 void CreateChromeApplicationShortcutView::InitControls() { |
| 66 create_shortcuts_label_ = new views::Label( | 69 create_shortcuts_label_ = new views::Label( |
| 67 l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); | 70 l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)); |
| 68 create_shortcuts_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 71 create_shortcuts_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 69 create_shortcuts_label_->SetMultiLine(true); | 72 create_shortcuts_label_->SetMultiLine(true); |
| 70 | 73 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 views::Checkbox* checkbox = new views::Checkbox(text); | 242 views::Checkbox* checkbox = new views::Checkbox(text); |
| 240 checkbox->SetChecked(checked); | 243 checkbox->SetChecked(checked); |
| 241 checkbox->set_listener(this); | 244 checkbox->set_listener(this); |
| 242 return checkbox; | 245 return checkbox; |
| 243 } | 246 } |
| 244 | 247 |
| 245 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( | 248 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( |
| 246 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { | 249 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { |
| 247 shortcut_info_ = std::move(shortcut_info); | 250 shortcut_info_ = std::move(shortcut_info); |
| 248 } | 251 } |
| OLD | NEW |