Chromium Code Reviews| Index: chrome/browser/ui/views/website_settings_popup_view.cc |
| diff --git a/chrome/browser/ui/views/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings_popup_view.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4deb26cafa776372eb457a84764cdd4db1d6b8e7 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/website_settings_popup_view.cc |
| @@ -0,0 +1,558 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/views/website_settings_popup_view.h" |
| + |
| +#include "base/string_number_conversions.h" |
| +#include "base/utf_string_conversions.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/website_settings.h" |
| +#include "chrome/browser/ui/views/collected_cookies_views.h" |
| +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| +#include "chrome/common/content_settings_types.h" |
| +#include "grit/generated_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| +#include "ui/gfx/font.h" |
| +#include "ui/views/controls/combobox/combobox.h" |
| +#include "ui/views/controls/label.h" |
| +#include "ui/views/controls/link.h" |
| +#include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
| +#include "ui/views/layout/box_layout.h" |
| +#include "ui/views/layout/grid_layout.h" |
| +#include "ui/views/layout/layout_manager.h" |
| + |
| +namespace { |
| + |
| +string16 PermissionTypeToString(ContentSettingsType type) { |
| + switch (type) { |
| + case CONTENT_SETTINGS_TYPE_POPUPS: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TYPE_POPUPS); |
| + case CONTENT_SETTINGS_TYPE_PLUGINS: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TYPE_PLUGINS); |
| + case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TYPE_LOCATION); |
| + case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TYPE_NOTIFICATIONS); |
| + default: |
| + NOTREACHED(); |
| + return ASCIIToUTF16(""); |
| + } |
| +} |
| + |
| +string16 PermissionValueToString(ContentSetting value) { |
| + switch (value) { |
| + case CONTENT_SETTING_ALLOW: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW); |
| + case CONTENT_SETTING_BLOCK: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK); |
| + case CONTENT_SETTING_ASK: |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK); |
| + default: |
| + NOTREACHED(); |
| + return ASCIIToUTF16(""); |
| + } |
| +} |
|
Finnur
2012/05/30 11:20:04
These two functions are a bit unfortunate since th
markusheintz_
2012/06/05 17:02:12
I created two methods for returning the ressource
|
| + |
| +} // namespace |
| + |
| +// //////////////////////////////////////////////////////////////////////////// |
| +// Popup Header |
| +// //////////////////////////////////////////////////////////////////////////// |
|
Finnur
2012/05/30 11:20:04
nit: To be consistent with other Chrome code, you
markusheintz_
2012/06/05 17:02:12
Done.
|
| + |
| +PopupHeader::PopupHeader() : name_(NULL), status_(NULL) { |
| + views::GridLayout* layout = new views::GridLayout(this); |
| + SetLayoutManager(layout); |
| + const int label_column = 0; |
| + views::ColumnSet* column_set = layout->AddColumnSet(label_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + |
| + layout->AddPaddingRow(0, 8); |
| + |
| + layout->StartRow(0, label_column); |
| + name_ = new views::Label(string16()); |
| + name_->SetFont(name_->font().DeriveFont(0, gfx::Font::BOLD)); |
| + layout->AddView(name_, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + |
| + layout->AddPaddingRow(0, 4); |
| + |
| + status_ = new views::Label(string16()); |
| + layout->StartRow(0, label_column); |
| + layout->AddView(status_, |
| + 1, |
| + 1, |
| + views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| +} |
| + |
| +PopupHeader::~PopupHeader() { |
| +} |
| + |
| +gfx::Size PopupHeader::GetPreferredSize() { |
| + return gfx::Size(300, 80); |
|
Finnur
2012/05/30 11:20:04
Do you mean to reserve space (80 pixels) even if n
markusheintz_
2012/06/05 17:02:12
The width 300 was meant prevent flickering. But it
|
| +} |
| + |
| +void PopupHeader::SetIdentityName(string16 name) { |
|
Finnur
2012/05/30 11:20:04
const string16&, same on line 105
markusheintz_
2012/06/05 17:02:12
Done (Damn it :) )
|
| + name_->SetText(name); |
| +} |
| + |
| +void PopupHeader::SetIdentityStatus(string16 status) { |
| + status_->SetText(status); |
| +} |
| + |
| + |
|
Finnur
2012/05/30 11:20:04
nit: Extra line break.
markusheintz_
2012/06/05 17:02:12
Done.
|
| +// //////////////////////////////////////////////////////////////////////////// |
| +// PermissionComboboxModel |
| +// //////////////////////////////////////////////////////////////////////////// |
| + |
| +PermissionComboboxModel::PermissionComboboxModel( |
| + ContentSettingsType site_permission, ContentSetting default_setting) |
| + : site_permission_(site_permission), |
| + default_setting_(default_setting){ |
| + settings_.push_back(CONTENT_SETTING_DEFAULT); |
| + settings_.push_back(CONTENT_SETTING_ALLOW); |
| + settings_.push_back(CONTENT_SETTING_BLOCK); |
| + if (site_permission == CONTENT_SETTINGS_TYPE_GEOLOCATION || |
| + site_permission == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| + settings_.push_back(CONTENT_SETTING_ASK); |
| + } |
| +} |
| + |
| +PermissionComboboxModel::~PermissionComboboxModel() { |
| +} |
| + |
| +ContentSetting PermissionComboboxModel::GetSettingAt(int index) const { |
| + if (index < static_cast<int>(settings_.size())) |
| + return settings_[index]; |
| + NOTREACHED(); |
| + return CONTENT_SETTING_DEFAULT; |
| +} |
| + |
| +int PermissionComboboxModel::GetItemCount() const { |
| + return settings_.size(); |
| +} |
| + |
| +string16 PermissionComboboxModel::GetItemAt(int index) { |
| + if (index == 0) |
| + return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_DEFAULT) |
| + + ASCIIToUTF16(" (") + PermissionValueToString(default_setting_) |
| + + ASCIIToUTF16(")"); |
|
Finnur
2012/05/30 11:20:04
String concatenations are generally a bad idea in
markusheintz_
2012/06/05 17:02:12
Done.
|
| + if (index < static_cast<int>(settings_.size())) |
| + return PermissionValueToString(settings_[index]); |
| + NOTREACHED(); |
| + return string16(); |
| +} |
| + |
| +// //////////////////////////////////////////////////////////////////////////// |
| +// WebsiteSettingsPopupView |
| +// //////////////////////////////////////////////////////////////////////////// |
| + |
| +WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
| + views::View* anchor_view, |
| + Profile* profile, |
|
Finnur
2012/05/30 11:20:04
Why do you need the |profile|?
markusheintz_
2012/06/05 17:02:12
I need it now to create the presenter (WebsiteSett
|
| + TabContentsWrapper* wrapper) |
| + : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
| + tab_contents_wrapper_(wrapper), |
| + presenter_(NULL), |
| + header_(NULL), |
| + tabbed_pane_(NULL), |
| + site_data_content_(NULL), |
| + cookie_dialog_link_(NULL), |
| + permissions_content_(NULL), |
| + identity_info_text_(NULL), |
| + connection_info_text_(NULL), |
| + page_info_text_(NULL) { |
| + views::GridLayout* layout = new views::GridLayout(this); |
| + SetLayoutManager(layout); |
| + const int content_column = 0; |
| + views::ColumnSet* column_set = layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + |
| + header_ = new PopupHeader(); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(header_); |
| + |
| + layout->AddPaddingRow(1, 10); |
| + |
| + tabbed_pane_ = new views::TabbedPane(); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(tabbed_pane_); |
| + // Tabs must be added after the tabbed_pane_ was added to the views hierachy. |
| + // Adding the |tabbed_pane_| to the views hierachy triggers the |
| + // initialization of the native tab UI element. If the native tab UI element |
| + // is not initalized adding a tab will result in a NULL pointer excetion. |
| + tabbed_pane_->AddTab( |
| + l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), |
| + CreatePermissionsTab()); |
| + tabbed_pane_->AddTab( |
| + l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_IDENTITY), |
| + CreateIdentityTab()); |
| + tabbed_pane_->SelectTabAt(0); |
| + tabbed_pane_->set_listener(this); |
| + |
| + views::BubbleDelegateView::CreateBubble(this); |
| + this->Show(); |
| + SizeToContents(); |
| +} |
| + |
| +WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { |
| + if (presenter_) |
| + presenter_->OnUIClosing(); |
| +} |
| + |
| +void WebsiteSettingsPopupView::SetPresenter(WebsiteSettings* presenter) { |
| + presenter_ = presenter; |
| +} |
| + |
| +void WebsiteSettingsPopupView::SetCookieInfo( |
| + const CookieInfoList& cookie_info_list) { |
| + site_data_content_->RemoveAllChildViews(true); |
| + |
| + views::GridLayout* layout = |
| + new views::GridLayout(site_data_content_); |
|
Finnur
2012/05/30 11:20:04
nit: This fits within one line.
markusheintz_
2012/06/05 17:02:12
Done.
|
| + site_data_content_->SetLayoutManager(layout); |
| + |
| + const int site_data_content_column = 0; |
| + views::ColumnSet* column_set = |
| + layout->AddColumnSet(site_data_content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + |
| + for (CookieInfoList::const_iterator it = cookie_info_list.begin(); |
| + it != cookie_info_list.end(); |
| + ++it) { |
| + // TODO(markusheintz): Add L10N strings for "allowed" and "blocked" once we |
| + // decided about the wording. |
| + std::string label_text = it->cookie_source + " ("; |
| + label_text += base::IntToString(it->allowed); |
| + label_text += " allowed / "; |
| + label_text += base::IntToString(it->blocked); |
| + label_text += " blocked)"; |
|
Finnur
2012/05/30 11:20:04
Same i18n argument here. It is easy to add a strin
markusheintz_
2012/06/05 17:02:12
Done.
|
| + layout->StartRow(1, site_data_content_column); |
| + layout->AddView(new views::Label(UTF8ToUTF16(label_text)), |
| + 1, |
| + 1, |
| + views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + |
| + layout->AddPaddingRow(1, 4); |
| + } |
| + |
| + layout->Layout(site_data_content_); |
| + SizeToContents(); |
| +} |
| + |
| +void WebsiteSettingsPopupView::SetPermissionInfo( |
| + const PermissionInfoList& permission_info_list) { |
| + permissions_content_->RemoveAllChildViews(true); |
| + |
| + views::GridLayout* layout = |
| + new views::GridLayout(permissions_content_); |
| + permissions_content_->SetLayoutManager(layout); |
| + const int content_column = 0; |
| + views::ColumnSet* column_set = |
| + layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + for (PermissionInfoList::const_iterator permission = |
| + permission_info_list.begin(); |
|
Finnur
2012/05/30 11:20:04
nit: You could move the initialization of |permiss
markusheintz_
2012/06/05 17:02:12
I don't know. Does this really improve the readabi
Finnur
2012/06/06 11:55:50
Like I said, up to you. :)
markusheintz_
2012/06/06 13:47:03
:)
|
| + permission != permission_info_list.end(); |
| + ++permission) { |
| + views::Label* label = |
| + new views::Label(PermissionTypeToString(permission->type)); |
| + views::Combobox* combobox = new views::Combobox( |
| + new PermissionComboboxModel(permission->type, |
| + permission->default_setting)); |
|
Finnur
2012/05/30 11:20:04
nit: align indentation of type with default_settin
markusheintz_
2012/06/05 17:02:12
Done.
|
| + switch (permission->setting) { |
| + case CONTENT_SETTING_DEFAULT: combobox->SetSelectedIndex(0); |
| + break; |
| + case CONTENT_SETTING_ALLOW: combobox->SetSelectedIndex(1); |
| + break; |
| + case CONTENT_SETTING_BLOCK: combobox->SetSelectedIndex(2); |
| + break; |
| + default: combobox->SetSelectedIndex(4); |
| + break; |
| + } |
| + combobox->set_listener(this); |
| + |
| + layout->StartRow(1, content_column); |
| + layout->AddView(CreatePermissionRow(label, combobox), |
| + 1, |
| + 1, |
| + views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + |
| + } |
| + |
| + SizeToContents(); |
| +} |
| + |
| +void WebsiteSettingsPopupView::SetIdentityInfo( |
| + const IdentityInfo& identity_info) { |
| + string16 identity_status_text; |
| + switch (identity_info.identity_status) { |
| + case WebsiteSettings::SITE_IDENTITY_STATUS_CERT: |
| + case WebsiteSettings::SITE_IDENTITY_STATUS_DNSSEC_CERT: |
| + case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT: |
| + identity_status_text = |
| + l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_VERIFIED); |
| + break; |
| + default: |
| + identity_status_text = |
| + l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_IDENTITY_NOT_VERIFIED); |
| + break; |
| + } |
| + header_->SetIdentityName(UTF8ToUTF16(identity_info.site_identity)); |
| + header_->SetIdentityStatus(identity_status_text); |
| + |
| + identity_info_text_->SetText( |
| + UTF8ToUTF16(identity_info.identity_status_description)); |
| + |
| + connection_info_text_->SetText( |
| + UTF8ToUTF16(identity_info.connection_status_description)); |
| + |
| + GetLayoutManager()->Layout(this); |
| + SizeToContents(); |
| +} |
| + |
| +gfx::Size WebsiteSettingsPopupView::GetPreferredSize() { |
| + int height = 0; |
| + int width = 300; |
| + if (header_) |
| + height += header_->GetPreferredSize().height(); |
| + if (tabbed_pane_) |
| + height += tabbed_pane_->GetPreferredSize().height(); |
| + |
| + gfx::Size size(width, height); |
| + return size; |
| +} |
| + |
| +void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) { |
| + page_info_text_->SetText(first_visit); |
| +} |
| + |
| +gfx::Rect WebsiteSettingsPopupView::GetAnchorRect() { |
| + // Compensate for some built-in padding in the icon. This will make the arrow |
| + // point to the mittle of the icon. |
|
Finnur
2012/05/30 11:20:04
Englisch, bitte!
s/mittle/middle/.
:)
markusheintz_
2012/06/05 17:02:12
Done. You won't believe it. But this is a copy and
|
| + gfx::Rect anchor(BubbleDelegateView::GetAnchorRect()); |
| + anchor.Inset(0, anchor_view() ? 5 : 0); |
|
Finnur
2012/05/30 11:20:04
Can you create a variable for this magic constant
markusheintz_
2012/06/05 17:02:12
Done.
|
| + return anchor; |
| +} |
| + |
| +void WebsiteSettingsPopupView::OnSelectedIndexChanged( |
| + views::Combobox* combobox) { |
| + PermissionComboboxModel* model = |
| + static_cast<PermissionComboboxModel*>(combobox->model()); |
| + DCHECK(model); |
| + presenter_->OnSitePermissionChanged( |
| + model->site_permission(), |
| + model->GetSettingAt(combobox->selected_index())); |
| +} |
| + |
| +void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
| + int event_flags) { |
| + if (source == cookie_dialog_link_) { |
| + new CollectedCookiesViews(tab_contents_wrapper_); |
| + GetWidget()->CloseNow(); |
| + } |
|
Finnur
2012/05/30 11:20:04
else NOTREACHED?
markusheintz_
2012/06/05 17:02:12
Done.
|
| +} |
| + |
| +void WebsiteSettingsPopupView::TabSelectedAt(int index) { |
| + tabbed_pane_->GetSelectedTab()->Layout(); |
| + SizeToContents(); |
| +} |
| + |
| +views::View* WebsiteSettingsPopupView::CreatePermissionsTab() { |
| + views::View* pane = new views::View(); |
| + pane->SetLayoutManager( |
| + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
| + |
| + cookie_dialog_link_ = new views::Link( |
| + l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA)); |
| + cookie_dialog_link_->set_listener(this); |
| + site_data_content_ = new views::View(); |
| + views::View* site_data_section = |
| + CreateSection(l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA), |
| + site_data_content_, |
| + cookie_dialog_link_); |
| + pane->AddChildView(site_data_section); |
| + |
| + permissions_content_ = new views::View(); |
| + views::View* permissions_section = |
| + CreateSection(l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_TITLE_SITE_PERMISSIONS), |
| + permissions_content_, |
| + NULL); |
| + pane->AddChildView(permissions_section); |
| + return pane; |
| +} |
| + |
| +views::View* WebsiteSettingsPopupView::CreateIdentityTab() { |
| + views::View* pane = new views::View(); |
| + pane->SetLayoutManager( |
| + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); |
| + |
| + // Add Identity section |
|
Finnur
2012/05/30 11:20:04
nit: End comments in period.
markusheintz_
2012/06/05 17:02:12
Done.
|
| + views::View* section_content = new views::View(); |
| + views::GridLayout* layout = |
| + new views::GridLayout(section_content); |
| + section_content->SetLayoutManager(layout); |
| + const int content_column = 0; |
| + views::ColumnSet* column_set = |
| + layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + identity_info_text_ = CreateTextLabel(string16()); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(identity_info_text_, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + views::View* section = |
| + CreateSection(l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_TITEL_IDENTITY), |
| + section_content, |
| + NULL); |
| + pane->AddChildView(section); |
| + |
| + // Add connection section. |
| + section_content = new views::View(); |
| + layout = new views::GridLayout(section_content); |
| + section_content->SetLayoutManager(layout); |
| + column_set = layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + connection_info_text_ = CreateTextLabel(string16()); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(connection_info_text_, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + section = CreateSection(l10n_util::GetStringUTF16( |
| + IDS_WEBSITE_SETTINGS_TITEL_CONNECTION), |
| + section_content, |
| + NULL); |
| + pane->AddChildView(section); |
| + |
| + // Add page info section. |
| + section_content = new views::View(); |
| + layout = new views::GridLayout(section_content); |
| + section_content->SetLayoutManager(layout); |
| + column_set = layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + page_info_text_ = CreateTextLabel(string16()); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(page_info_text_, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + section = CreateSection(l10n_util::GetStringUTF16( |
| + IDS_PAGE_INFO_SITE_INFO_TITLE), |
| + section_content, |
| + NULL); |
| + pane->AddChildView(section); |
| + |
| + return pane; |
| +} |
| + |
| +views::View* WebsiteSettingsPopupView::CreateSection( |
| + string16 headline_text, |
| + views::View* content, |
| + views::Link* link) { |
| + views::View* container = new views::View(); |
| + views::GridLayout* layout = new views::GridLayout(container); |
| + container->SetLayoutManager(layout); |
| + const int content_column = 0; |
| + views::ColumnSet* column_set = layout->AddColumnSet(content_column); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + |
| + layout->AddPaddingRow(1, 4); |
| + layout->StartRow(1, content_column); |
| + views::Label* headline = new views::Label(headline_text); |
| + headline->SetFont(headline->font().DeriveFont(0, gfx::Font::BOLD)); |
| + layout->AddView(headline, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + |
| + layout->AddPaddingRow(1, 4); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(content, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + |
| + if (link) { |
| + layout->AddPaddingRow(1, 4); |
| + layout->StartRow(1, content_column); |
| + layout->AddView(link, 1, 1, views::GridLayout::LEADING, |
| + views::GridLayout::CENTER); |
| + } |
| + |
| + return container; |
| +} |
| + |
| +views::View* WebsiteSettingsPopupView::CreatePermissionRow( |
| + views::Label* label, |
| + views::Combobox* combobox) { |
| + views::View* container = new views::View(); |
| + views::GridLayout* layout = new views::GridLayout(container); |
| + container->SetLayoutManager(layout); |
| + const int two_column_layout = 0; |
| + views::ColumnSet* column_set = layout->AddColumnSet(two_column_layout); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + column_set->AddPaddingColumn(0, 8); |
| + column_set->AddColumn(views::GridLayout::FILL, |
| + views::GridLayout::FILL, |
| + 1, |
| + views::GridLayout::USE_PREF, |
| + 0, |
| + 0); |
| + |
| + layout->StartRow(1, two_column_layout); |
| + layout->AddView(label); |
| + layout->AddView(combobox); |
| + return container; |
| +} |
| + |
| +views::Label* WebsiteSettingsPopupView::CreateTextLabel(string16 text) { |
| + views::Label* label = new views::Label(text); |
| + label->SetMultiLine(true); |
| + label->SetAllowCharacterBreak(true); |
| + label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| + return label; |
| +} |
| + |
|
Finnur
2012/05/30 11:20:04
Is there an extra space here at the end?
markusheintz_
2012/06/05 17:02:12
Removed.
|