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

Side by Side Diff: chrome/browser/ui/views/about_chrome_view.cc

Issue 8609002: CrOs: Remove 16 exit time destructors and 11 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/about_chrome_view.h" 5 #include "chrome/browser/ui/views/about_chrome_view.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <commdlg.h> 8 #include <commdlg.h>
9 #endif // defined(OS_WIN) 9 #endif // defined(OS_WIN)
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/installer/util/install_util.h" 50 #include "chrome/installer/util/install_util.h"
51 #endif // defined(OS_WIN) 51 #endif // defined(OS_WIN)
52 52
53 // The amount of vertical space separating the error label at the bottom from 53 // The amount of vertical space separating the error label at the bottom from
54 // the rest of the text. 54 // the rest of the text.
55 static const int kErrorLabelVerticalSpacing = 15; // Pixels. 55 static const int kErrorLabelVerticalSpacing = 15; // Pixels.
56 56
57 namespace { 57 namespace {
58 // These are used as placeholder text around the links in the text in the about 58 // These are used as placeholder text around the links in the text in the about
59 // dialog. 59 // dialog.
60 const string16 kBeginLink(ASCIIToUTF16("BEGIN_LINK")); 60 string16 kBeginLink() {
Ryan Sleevi 2011/11/20 23:10:49 Is it worth doing const char16 kBeginLink[] = { '
61 const string16 kEndLink(ASCIIToUTF16("END_LINK")); 61 return ASCIIToUTF16("BEGIN_LINK");
62 const string16 kBeginLinkChr(ASCIIToUTF16("BEGIN_LINK_CHR")); 62 }
63 const string16 kBeginLinkOss(ASCIIToUTF16("BEGIN_LINK_OSS")); 63 string16 kEndLink() {
64 const string16 kEndLinkChr(ASCIIToUTF16("END_LINK_CHR")); 64 return ASCIIToUTF16("END_LINK");
65 const string16 kEndLinkOss(ASCIIToUTF16("END_LINK_OSS")); 65 }
66 string16 kBeginLinkChr() {
67 return ASCIIToUTF16("BEGIN_LINK_CHR");
68 }
69 string16 kBeginLinkOss() {
70 return ASCIIToUTF16("BEGIN_LINK_OSS");
71 }
72 string16 kEndLinkChr() {
73 return ASCIIToUTF16("END_LINK_CHR");
74 }
75 string16 kEndLinkOss() {
76 return ASCIIToUTF16("END_LINK_OSS");
77 }
66 78
67 // Returns a substring from |text| between start and end. 79 // Returns a substring from |text| between start and end.
68 string16 StringSubRange(const string16& text, size_t start, size_t end) { 80 string16 StringSubRange(const string16& text, size_t start, size_t end) {
69 DCHECK(end > start); 81 DCHECK(end > start);
70 return text.substr(start, end - start); 82 return text.substr(start, end - start);
71 } 83 }
72 84
73 } // namespace 85 } // namespace
74 86
75 namespace browser { 87 namespace browser {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT)); 201 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT));
190 copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 202 copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
191 AddChildView(copyright_label_); 203 AddChildView(copyright_label_);
192 204
193 main_text_label_ = new views::Label(string16()); 205 main_text_label_ = new views::Label(string16());
194 206
195 // Figure out what to write in the main label of the About box. 207 // Figure out what to write in the main label of the About box.
196 string16 text = l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE); 208 string16 text = l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE);
197 209
198 chromium_url_appears_first_ = 210 chromium_url_appears_first_ =
199 text.find(kBeginLinkChr) < text.find(kBeginLinkOss); 211 text.find(kBeginLinkChr()) < text.find(kBeginLinkOss());
200 212
201 size_t link1 = text.find(kBeginLink); 213 size_t link1 = text.find(kBeginLink());
202 DCHECK(link1 != string16::npos); 214 DCHECK(link1 != string16::npos);
203 size_t link1_end = text.find(kEndLink, link1); 215 size_t link1_end = text.find(kEndLink(), link1);
204 DCHECK(link1_end != string16::npos); 216 DCHECK(link1_end != string16::npos);
205 size_t link2 = text.find(kBeginLink, link1_end); 217 size_t link2 = text.find(kBeginLink(), link1_end);
206 DCHECK(link2 != string16::npos); 218 DCHECK(link2 != string16::npos);
207 size_t link2_end = text.find(kEndLink, link2); 219 size_t link2_end = text.find(kEndLink(), link2);
208 DCHECK(link1_end != string16::npos); 220 DCHECK(link1_end != string16::npos);
209 221
210 main_label_chunk1_ = text.substr(0, link1); 222 main_label_chunk1_ = text.substr(0, link1);
211 main_label_chunk2_ = StringSubRange(text, link1_end + kEndLinkOss.size(), 223 main_label_chunk2_ = StringSubRange(text, link1_end + kEndLinkOss().size(),
212 link2); 224 link2);
213 main_label_chunk3_ = text.substr(link2_end + kEndLinkOss.size()); 225 main_label_chunk3_ = text.substr(link2_end + kEndLinkOss().size());
214 226
215 // The Chromium link within the main text of the dialog. 227 // The Chromium link within the main text of the dialog.
216 chromium_url_ = new views::Link( 228 chromium_url_ = new views::Link(
217 StringSubRange(text, text.find(kBeginLinkChr) + kBeginLinkChr.size(), 229 StringSubRange(text, text.find(kBeginLinkChr()) + kBeginLinkChr().size(),
218 text.find(kEndLinkChr))); 230 text.find(kEndLinkChr())));
219 AddChildView(chromium_url_); 231 AddChildView(chromium_url_);
220 chromium_url_->set_listener(this); 232 chromium_url_->set_listener(this);
221 233
222 // The Open Source link within the main text of the dialog. 234 // The Open Source link within the main text of the dialog.
223 open_source_url_ = new views::Link( 235 open_source_url_ = new views::Link(
224 StringSubRange(text, text.find(kBeginLinkOss) + kBeginLinkOss.size(), 236 StringSubRange(text, text.find(kBeginLinkOss()) + kBeginLinkOss().size(),
225 text.find(kEndLinkOss))); 237 text.find(kEndLinkOss())));
226 AddChildView(open_source_url_); 238 AddChildView(open_source_url_);
227 open_source_url_->set_listener(this); 239 open_source_url_->set_listener(this);
228 240
229 #if defined(OS_WIN) 241 #if defined(OS_WIN)
230 SkColor background_color = color_utils::GetSysSkColor(COLOR_3DFACE); 242 SkColor background_color = color_utils::GetSysSkColor(COLOR_3DFACE);
231 copyright_label_->SetBackgroundColor(background_color); 243 copyright_label_->SetBackgroundColor(background_color);
232 main_text_label_->SetBackgroundColor(background_color); 244 main_text_label_->SetBackgroundColor(background_color);
233 chromium_url_->SetBackgroundColor(background_color); 245 chromium_url_->SetBackgroundColor(background_color);
234 open_source_url_->SetBackgroundColor(background_color); 246 open_source_url_->SetBackgroundColor(background_color);
235 #endif 247 #endif
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 int height = error_label_->GetHeightForWidth( 790 int height = error_label_->GetHeightForWidth(
779 dialog_dimensions_.width() - (2 * views::kPanelHorizMargin)) + 791 dialog_dimensions_.width() - (2 * views::kPanelHorizMargin)) +
780 views::kRelatedControlVerticalSpacing; 792 views::kRelatedControlVerticalSpacing;
781 window_rect.set_height(window_rect.height() + height); 793 window_rect.set_height(window_rect.height() + height);
782 GetWidget()->SetBounds(window_rect); 794 GetWidget()->SetBounds(window_rect);
783 795
784 return height; 796 return height;
785 } 797 }
786 798
787 #endif 799 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698