Commit 8a503d82 authored by groby@chromium.org's avatar groby@chromium.org

Factoring out common constants

TBR=thakis@chromium.org
R=gbillock@chromium.org
BUG=none


Review URL: https://chromiumcodereview.appspot.com/10827341

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151850 0039d316-1c4b-4281-b951-d872f2087c98
parent aba1d2ce
......@@ -48,19 +48,12 @@ using content::WebContents;
namespace {
// The width in pixels of the area between the icon on the left and the close
// button on the right.
const int kMainContentWidth = 400;
// The pixel size of the header label when using a non-native theme.
const int kHeaderLabelPixelSize = 15;
// The pixel size of the font of the main content of the dialog.
const int kMainContentPixelSize = 13;
// The maximum width in pixels of a suggested extension's title link.
const int kTitleLinkMaxWidth = 130;
// Indices of the extension row widgets.
enum {
kIconIndex,
......@@ -416,7 +409,7 @@ void WebIntentPickerGtk::OnPendingAsyncCompleted() {
// Set the label width to the size of |sub_contents|, which we don't have
// access to yet, by calculating the main content width minus borders.
gtk_util::SetLabelWidth(no_service_label,
kMainContentWidth - 2 * ui::kContentAreaBorder);
kWindowWidth - 2 * ui::kContentAreaBorder);
gtk_box_pack_start(GTK_BOX(hbox), no_service_label, TRUE, TRUE, 0);
gtk_widget_show_all(contents_);
......@@ -537,7 +530,7 @@ void WebIntentPickerGtk::InitContents() {
g_signal_connect(contents_, "destroy", G_CALLBACK(&OnDestroyThunk), this);
}
gtk_widget_set_size_request(contents_, kMainContentWidth, -1);
gtk_widget_set_size_request(contents_, kWindowWidth, -1);
if (model_ && model_->IsWaitingForSuggestions()) {
gtk_util::RemoveAllChildren(contents_);
......@@ -581,7 +574,7 @@ void WebIntentPickerGtk::InitMainContents() {
// Set the label width to the size of |sub_contents|, which we don't have
// access to yet, by calculating the main content width minus borders.
gtk_util::SetLabelWidth(cws_label_,
kMainContentWidth - 2 * ui::kContentAreaBorder);
kWindowWidth - 2 * ui::kContentAreaBorder);
gtk_util::ForceFontSizePixels(cws_label_, kMainContentPixelSize);
// Suggested extensions vbox.
......
......@@ -23,6 +23,16 @@ class WebContents;
// Base class for the web intent picker dialog.
class WebIntentPicker {
public:
// The width of the window, in view coordinates. The height will be
// determined by the content.
static const int kWindowWidth = 400;
// The maximum width in view units of a suggested extension's title link.
static const int kTitleLinkMaxWidth = 130;
// The space in pixels between the top-level groups and the dialog border.
static const int kContentAreaBorder = 10;
// Platform specific factory function. This function will automatically show
// the picker.
static WebIntentPicker* Create(TabContents* tab_contents,
......
......@@ -62,15 +62,6 @@ using views::GridLayout;
namespace {
// The space in pixels between the top-level groups and the dialog border.
const int kContentAreaBorder = 12;
// The minimum size to display the constrained dialog.
const int kDialogMinWidth = 400;
// The maximum width in pixels of a suggested extension's title link.
const int kTitleLinkMaxWidth = 130;
// The color used to dim disabled elements.
const SkColor kHalfOpacityWhite = SkColorSetARGB(128, 255, 255, 255);
......@@ -507,8 +498,9 @@ SuggestedExtensionsRowView::SuggestedExtensionsRowView(
icon_->SetImage(extension_->icon.ToImageSkia());
AddChildView(icon_);
string16 elided_title = ui::ElideText(
extension_->title, gfx::Font(), kTitleLinkMaxWidth, ui::ELIDE_AT_END);
string16 elided_title = ui::ElideText(extension_->title, gfx::Font(),
WebIntentPicker::kTitleLinkMaxWidth,
ui::ELIDE_AT_END);
title_link_ = new views::Link(elided_title);
title_link_->set_listener(this);
AddChildView(title_link_);
......@@ -1107,7 +1099,7 @@ void WebIntentPickerViews::InitContents() {
views::GridLayout* grid_layout = new views::GridLayout(contents_);
contents_->SetLayoutManager(grid_layout);
grid_layout->set_minimum_size(gfx::Size(kDialogMinWidth, 0));
grid_layout->set_minimum_size(gfx::Size(kWindowWidth, 0));
grid_layout->SetInsets(kContentAreaBorder, kContentAreaBorder,
kContentAreaBorder, kContentAreaBorder);
views::ColumnSet* header_cs = grid_layout->AddColumnSet(kHeaderRowColumnSet);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment