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

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

Issue 10827341: Factoring out common constants (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cocoa namespacing. Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "ui/views/view.h" 53 #include "ui/views/view.h"
54 #include "ui/views/widget/widget.h" 54 #include "ui/views/widget/widget.h"
55 #include "ui/views/window/dialog_delegate.h" 55 #include "ui/views/window/dialog_delegate.h"
56 #include "ui/views/window/non_client_view.h" 56 #include "ui/views/window/non_client_view.h"
57 57
58 using content::WebContents; 58 using content::WebContents;
59 using views::GridLayout; 59 using views::GridLayout;
60 60
61 namespace { 61 namespace {
62 62
63 // The space in pixels between the top-level groups and the dialog border.
64 const int kContentAreaBorder = 12;
65
66 // The minimum size to display the constrained dialog.
67 const int kDialogMinWidth = 400;
68
69 // The maximum width in pixels of a suggested extension's title link.
70 const int kTitleLinkMaxWidth = 130;
71
72 // The color used to dim disabled elements. 63 // The color used to dim disabled elements.
73 const SkColor kHalfOpacityWhite = SkColorSetARGB(128, 255, 255, 255); 64 const SkColor kHalfOpacityWhite = SkColorSetARGB(128, 255, 255, 255);
74 65
75 // The color used to display a disabled link. 66 // The color used to display a disabled link.
76 const SkColor kDisabledLinkColor = SkColorSetRGB(128, 128, 128); 67 const SkColor kDisabledLinkColor = SkColorSetRGB(128, 128, 128);
77 68
78 // The time between successive throbber frames in milliseconds. 69 // The time between successive throbber frames in milliseconds.
79 const int kThrobberFrameTimeMs = 50; 70 const int kThrobberFrameTimeMs = 50;
80 71
81 // Enables or disables all child views of |view|. 72 // Enables or disables all child views of |view|.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 const WebIntentPickerModel::SuggestedExtension* extension, 489 const WebIntentPickerModel::SuggestedExtension* extension,
499 Delegate* delegate) 490 Delegate* delegate)
500 : extension_(extension), 491 : extension_(extension),
501 delegate_(delegate) { 492 delegate_(delegate) {
502 SetLayoutManager(new SuggestedExtensionsLayout); 493 SetLayoutManager(new SuggestedExtensionsLayout);
503 494
504 icon_ = new views::ImageView(); 495 icon_ = new views::ImageView();
505 icon_->SetImage(extension_->icon.ToImageSkia()); 496 icon_->SetImage(extension_->icon.ToImageSkia());
506 AddChildView(icon_); 497 AddChildView(icon_);
507 498
508 string16 elided_title = ui::ElideText( 499 string16 elided_title = ui::ElideText(extension_->title, gfx::Font(),
509 extension_->title, gfx::Font(), kTitleLinkMaxWidth, ui::ELIDE_AT_END); 500 WebIntentPicker::kTitleLinkMaxWidth,
501 ui::ELIDE_AT_END);
510 title_link_ = new views::Link(elided_title); 502 title_link_ = new views::Link(elided_title);
511 title_link_->set_listener(this); 503 title_link_->set_listener(this);
512 AddChildView(title_link_); 504 AddChildView(title_link_);
513 505
514 stars_ = new StarsView(extension_->average_rating); 506 stars_ = new StarsView(extension_->average_rating);
515 AddChildView(stars_); 507 AddChildView(stars_);
516 508
517 install_button_= new ThrobberNativeTextButton( 509 install_button_= new ThrobberNativeTextButton(
518 this, l10n_util::GetStringUTF16(IDS_INTENT_PICKER_INSTALL_EXTENSION)); 510 this, l10n_util::GetStringUTF16(IDS_INTENT_PICKER_INSTALL_EXTENSION));
519 AddChildView(install_button_); 511 AddChildView(install_button_);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 if (contents_) { 1079 if (contents_) {
1088 // Replace the picker with the inline disposition. 1080 // Replace the picker with the inline disposition.
1089 contents_->RemoveAllChildViews(true); 1081 contents_->RemoveAllChildViews(true);
1090 displaying_web_contents_ = false; 1082 displaying_web_contents_ = false;
1091 } else { 1083 } else {
1092 contents_ = new views::View(); 1084 contents_ = new views::View();
1093 } 1085 }
1094 views::GridLayout* grid_layout = new views::GridLayout(contents_); 1086 views::GridLayout* grid_layout = new views::GridLayout(contents_);
1095 contents_->SetLayoutManager(grid_layout); 1087 contents_->SetLayoutManager(grid_layout);
1096 1088
1097 grid_layout->set_minimum_size(gfx::Size(kDialogMinWidth, 0)); 1089 grid_layout->set_minimum_size(gfx::Size(kWindowWidth, 0));
1098 grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder, 1090 grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder,
1099 kContentAreaBorder, kContentAreaBorder); 1091 kContentAreaBorder, kContentAreaBorder);
1100 views::ColumnSet* header_cs = grid_layout->AddColumnSet(kHeaderRowColumnSet); 1092 views::ColumnSet* header_cs = grid_layout->AddColumnSet(kHeaderRowColumnSet);
1101 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, 1093 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0,
1102 GridLayout::USE_PREF, 0, 0); // Title. 1094 GridLayout::USE_PREF, 0, 0); // Title.
1103 header_cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing); 1095 header_cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing);
1104 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, 1096 header_cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0,
1105 GridLayout::USE_PREF, 0, 0); // Close Button. 1097 GridLayout::USE_PREF, 0, 0); // Close Button.
1106 1098
1107 views::ColumnSet* full_cs = grid_layout->AddColumnSet(kFullWidthColumnSet); 1099 views::ColumnSet* full_cs = grid_layout->AddColumnSet(kFullWidthColumnSet);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1183 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1192 views::ImageButton* close_button = new views::ImageButton(this); 1184 views::ImageButton* close_button = new views::ImageButton(this);
1193 close_button->SetImage(views::CustomButton::BS_NORMAL, 1185 close_button->SetImage(views::CustomButton::BS_NORMAL,
1194 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X)); 1186 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X));
1195 close_button->SetImage(views::CustomButton::BS_HOT, 1187 close_button->SetImage(views::CustomButton::BS_HOT,
1196 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); 1188 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1197 close_button->SetImage(views::CustomButton::BS_PUSHED, 1189 close_button->SetImage(views::CustomButton::BS_PUSHED,
1198 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); 1190 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1199 return close_button; 1191 return close_button;
1200 } 1192 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698