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 <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/extensions/tab_helper.h" | 16 #include "chrome/browser/extensions/tab_helper.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 20 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
22 #include "chrome/browser/web_applications/web_app.h" | 23 #include "chrome/browser/web_applications/web_app.h" |
23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
26 #include "chrome/grit/locale_settings.h" | 27 #include "chrome/grit/locale_settings.h" |
27 #include "components/constrained_window/constrained_window_views.h" | 28 #include "components/constrained_window/constrained_window_views.h" |
28 #include "components/favicon_base/select_favicon_frames.h" | 29 #include "components/favicon_base/select_favicon_frames.h" |
29 #include "components/prefs/pref_service.h" | 30 #include "components/prefs/pref_service.h" |
30 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 101 } |
101 | 102 |
102 void AppInfoView::Init(const base::string16& title_text, | 103 void AppInfoView::Init(const base::string16& title_text, |
103 const base::string16& description_text, | 104 const base::string16& description_text, |
104 const gfx::ImageFamily& icon) { | 105 const gfx::ImageFamily& icon) { |
105 icon_ = new views::ImageView(); | 106 icon_ = new views::ImageView(); |
106 UpdateIcon(icon); | 107 UpdateIcon(icon); |
107 icon_->SetImageSize(gfx::Size(kIconPreviewSizePixels, | 108 icon_->SetImageSize(gfx::Size(kIconPreviewSizePixels, |
108 kIconPreviewSizePixels)); | 109 kIconPreviewSizePixels)); |
109 | 110 |
110 title_ = new views::Label( | 111 title_ = |
111 title_text, | 112 new views::Label(title_text, CONTEXT_BODY_TEXT_SMALL, STYLE_EMPHASIZED); |
112 ui::ResourceBundle::GetSharedInstance().GetFontList( | |
113 ui::ResourceBundle::BoldFont)); | |
114 title_->SetMultiLine(true); | 113 title_->SetMultiLine(true); |
115 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 114 title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
116 | 115 |
117 PrepareDescriptionLabel(description_text); | 116 PrepareDescriptionLabel(description_text); |
118 | 117 |
119 SetupLayout(); | 118 SetupLayout(); |
120 } | 119 } |
121 | 120 |
122 void AppInfoView::PrepareDescriptionLabel(const base::string16& description) { | 121 void AppInfoView::PrepareDescriptionLabel(const base::string16& description) { |
123 // Do not make space for the description if it is empty. | 122 // Do not make space for the description if it is empty. |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 bool CreateChromeApplicationShortcutView::Cancel() { | 537 bool CreateChromeApplicationShortcutView::Cancel() { |
539 if (!close_callback_.is_null()) | 538 if (!close_callback_.is_null()) |
540 close_callback_.Run(false); | 539 close_callback_.Run(false); |
541 return CreateApplicationShortcutView::Cancel(); | 540 return CreateApplicationShortcutView::Cancel(); |
542 } | 541 } |
543 | 542 |
544 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( | 543 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( |
545 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { | 544 std::unique_ptr<web_app::ShortcutInfo> shortcut_info) { |
546 shortcut_info_ = std::move(shortcut_info); | 545 shortcut_info_ = std::move(shortcut_info); |
547 } | 546 } |
OLD | NEW |