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

Side by Side Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/apps/app_info_dialog/app_info_header_panel.h" 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_util.h" 10 #include "chrome/browser/extensions/extension_util.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/extensions/extension_constants.h" 12 #include "chrome/common/extensions/extension_constants.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "extensions/browser/extension_system.h" 14 #include "extensions/browser/extension_system.h"
15 #include "extensions/browser/image_loader.h" 15 #include "extensions/browser/image_loader.h"
16 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
17 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
18 #include "extensions/common/extension_icon_set.h" 18 #include "extensions/common/extension_icon_set.h"
19 #include "extensions/common/extension_resource.h" 19 #include "extensions/common/extension_resource.h"
20 #include "extensions/common/manifest_handlers/icons_handler.h" 20 #include "extensions/common/manifest_handlers/icons_handler.h"
21 #include "extensions/common/manifest_url_handlers.h" 21 #include "extensions/common/manifest_url_handlers.h"
22 #include "net/base/url_util.h" 22 #include "net/base/url_util.h"
23 #include "third_party/skia/include/core/SkBitmap.h" 23 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
27 #include "ui/gfx/image/image.h" 26 #include "ui/gfx/image/image.h"
28 #include "ui/gfx/image/image_skia.h" 27 #include "ui/gfx/image/image_skia.h"
29 #include "ui/gfx/image/image_skia_rep.h" 28 #include "ui/gfx/image/image_skia_rep.h"
30 #include "ui/gfx/native_widget_types.h" 29 #include "ui/gfx/native_widget_types.h"
31 #include "ui/gfx/text_constants.h" 30 #include "ui/gfx/text_constants.h"
32 #include "ui/views/controls/image_view.h" 31 #include "ui/views/controls/image_view.h"
33 #include "ui/views/controls/label.h" 32 #include "ui/views/controls/label.h"
34 #include "ui/views/controls/link.h" 33 #include "ui/views/controls/link.h"
35 #include "ui/views/layout/box_layout.h" 34 #include "ui/views/layout/box_layout.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 69
71 // Create a vertical container to store the app's name and link. 70 // Create a vertical container to store the app's name and link.
72 views::View* vertical_info_container = new views::View(); 71 views::View* vertical_info_container = new views::View();
73 views::BoxLayout* vertical_container_layout = 72 views::BoxLayout* vertical_container_layout =
74 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 73 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
75 vertical_container_layout->set_main_axis_alignment( 74 vertical_container_layout->set_main_axis_alignment(
76 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); 75 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
77 vertical_info_container->SetLayoutManager(vertical_container_layout); 76 vertical_info_container->SetLayoutManager(vertical_container_layout);
78 AddChildView(vertical_info_container); 77 AddChildView(vertical_info_container);
79 78
80 views::Label* app_name_label = 79 views::Label* app_name_label = new views::Label(
81 new views::Label(base::UTF8ToUTF16(app_->name()), 80 base::UTF8ToUTF16(app_->name()), views::style::CONTEXT_DIALOG_TITLE);
82 ui::ResourceBundle::GetSharedInstance().GetFontList(
83 ui::ResourceBundle::MediumFont));
84 app_name_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 81 app_name_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
85 vertical_info_container->AddChildView(app_name_label); 82 vertical_info_container->AddChildView(app_name_label);
86 83
87 if (CanShowAppInWebStore()) { 84 if (CanShowAppInWebStore()) {
88 view_in_store_link_ = new views::Link( 85 view_in_store_link_ = new views::Link(
89 l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_WEB_STORE_LINK)); 86 l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_WEB_STORE_LINK));
90 view_in_store_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 87 view_in_store_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
91 view_in_store_link_->set_listener(this); 88 view_in_store_link_->set_listener(this);
92 vertical_info_container->AddChildView(view_in_store_link_); 89 vertical_info_container->AddChildView(view_in_store_link_);
93 } else { 90 } else {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 130 }
134 131
135 bool AppInfoHeaderPanel::CanShowAppInWebStore() const { 132 bool AppInfoHeaderPanel::CanShowAppInWebStore() const {
136 // Hide the webstore link for apps which were installed by default, 133 // Hide the webstore link for apps which were installed by default,
137 // since this could leak user counts for OEM-specific apps. 134 // since this could leak user counts for OEM-specific apps.
138 // Also hide Shared Modules because they are automatically installed 135 // Also hide Shared Modules because they are automatically installed
139 // by Chrome when dependent Apps are installed. 136 // by Chrome when dependent Apps are installed.
140 return app_->from_webstore() && !app_->was_installed_by_default() && 137 return app_->from_webstore() && !app_->was_installed_by_default() &&
141 !app_->is_shared_module(); 138 !app_->is_shared_module();
142 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698