OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 if (!description_text.empty()) { | 102 if (!description_text.empty()) { |
103 PrepareDescriptionLabel(description_text); | 103 PrepareDescriptionLabel(description_text); |
104 } | 104 } |
105 | 105 |
106 SetupLayout(); | 106 SetupLayout(); |
107 } | 107 } |
108 | 108 |
109 void AppInfoView::PrepareDescriptionLabel(const string16& description) { | 109 void AppInfoView::PrepareDescriptionLabel(const string16& description) { |
110 DCHECK(!description.empty()); | 110 DCHECK(!description.empty()); |
111 | 111 |
112 static const size_t kMaxLength = 200; | 112 const size_t kMaxLength = 200; |
113 static const string16 kEllipsis(ASCIIToUTF16(" ... ")); | 113 const string16 kEllipsis(ASCIIToUTF16(" ... ")); |
Ryan Sleevi
2011/11/20 23:10:49
Same here (const char16 ...[] = { ' ', '.', '.', '
Nico
2011/11/20 23:12:59
I doubt this is a hotspot.
| |
114 | 114 |
115 string16 text = description; | 115 string16 text = description; |
116 if (text.length() > kMaxLength) { | 116 if (text.length() > kMaxLength) { |
117 text = text.substr(0, kMaxLength); | 117 text = text.substr(0, kMaxLength); |
118 text += kEllipsis; | 118 text += kEllipsis; |
119 } | 119 } |
120 | 120 |
121 if (description_) { | 121 if (description_) { |
122 description_->SetText(text); | 122 description_->SetText(text); |
123 } else { | 123 } else { |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 // Called by tracker_ when the app's icon is loaded. | 523 // Called by tracker_ when the app's icon is loaded. |
524 void CreateChromeApplicationShortcutView::OnImageLoaded( | 524 void CreateChromeApplicationShortcutView::OnImageLoaded( |
525 SkBitmap* image, const ExtensionResource& resource, int index) { | 525 SkBitmap* image, const ExtensionResource& resource, int index) { |
526 if (!image || image->isNull()) | 526 if (!image || image->isNull()) |
527 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); | 527 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); |
528 | 528 |
529 shortcut_info_.favicon = *image; | 529 shortcut_info_.favicon = *image; |
530 CHECK(app_info_); | 530 CHECK(app_info_); |
531 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 531 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
532 } | 532 } |
OLD | NEW |