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

Unified Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 10829452: Auto select the connection tab of the Website Settings UI in case of an https error or mixed content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add views specific parts. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
index d1a74e78fa9ebecea3d5e295ac023f2c44d34b60..295915ba8ff2ca2c97583830874672941ef42a80 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
@@ -313,14 +313,13 @@ WebsiteSettingsPopupView::WebsiteSettingsPopupView(
// 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.
+ // exception.
tabbed_pane_->AddTab(
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS),
CreatePermissionsTab());
tabbed_pane_->AddTab(
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION),
CreateConnectionTab());
- tabbed_pane_->SelectTabAt(0);
tabbed_pane_->set_listener(this);
set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft,
@@ -363,7 +362,7 @@ void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
} else if (source == certificate_dialog_link_) {
gfx::NativeWindow parent =
anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL;
-ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_);
+ ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_);
}
// The popup closes automatically when the collected cookies dialog or the
// certificate viewer opens.
@@ -522,8 +521,14 @@ void WebsiteSettingsPopupView::SetIdentityInfo(
UTF8ToUTF16(identity_info.connection_status_description),
NULL);
- Layout();
- SizeToContents();
+ // TODO(markusheintz): This is a hack to resize the connection tab contents
+ // correctly. If this is not done then the connection tab does not disaply
msw 2012/08/23 01:01:35 spelling nit: display, grammar nit: "not done, the
markusheintz_ 2012/08/23 19:46:21 Done.
+ // its contents correctly in case it is selected as visible tab when the
+ // |WebsiteSettingsPopupView| is opened. Fix this.
markusheintz_ 2012/08/23 00:49:14 @msw,sky: I wish I could have come up with somethi
msw 2012/08/23 01:01:35 This hacks seems okay for now, I suppose. Perhaps
markusheintz_ 2012/08/23 19:46:21 This is a good guess. And it's also easy to do sin
+ int tab_index = tabbed_pane_->GetSelectedTabIndex();
+ tabbed_pane_->SelectTabAt(0);
+ tabbed_pane_->SelectTabAt(1);
+ tabbed_pane_->SelectTabAt(tab_index);
sky 2012/08/23 04:01:48 Oy, why the hack? Can't we fix this correctly?
markusheintz_ 2012/08/23 19:46:21 That's the plan :) (to fix it correctly). The pro
msw 2012/08/23 20:11:30 TabLayout::SwitchToPage calls SetBoundsRect on the
markusheintz_ 2012/08/23 20:34:33 It does http://code.google.com/searchframe#OAMlx_
msw 2012/08/23 21:26:39 Sorry, I missed that... hmm, I'm out of ideas with
markusheintz_ 2012/08/23 22:21:34 The InvalidayLayout version works perfect. Thing
msw 2012/08/23 22:59:41 Use InvalidateLayout unless Scott objects :)
sky 2012/08/24 17:41:30 Mike's right, InvalidateLayout is what you want. A
}
void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) {
@@ -537,6 +542,12 @@ void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) {
SizeToContents();
}
+void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) {
+ DCHECK_EQ(TAB_ID_PERMISSIONS, 0);
msw 2012/08/23 01:01:35 nit: it's silly to DCHECK this on each platform se
markusheintz_ 2012/08/23 19:46:21 1) I think the DCHECKS document pretty nice the re
msw 2012/08/23 20:11:30 These (and the GTK and [future] Mac) DCHECKs just
markusheintz_ 2012/08/23 20:34:33 I definitely agree that duplicated code sucks :).
msw 2012/08/23 21:26:39 Elliot's okay with my new plan: 1) Remove these an
markusheintz_ 2012/08/23 22:21:34 Thanks a lot for checking with Elliot! The new is
msw 2012/08/23 22:59:41 'twas my idea, Elliot liked it too :)
markusheintz_ 2012/08/24 12:42:43 +1 done :-)
+ DCHECK_EQ(TAB_ID_CONNECTION, 1);
+ tabbed_pane_->SelectTabAt(tab_id);
+}
+
views::View* WebsiteSettingsPopupView::CreatePermissionsTab() {
views::View* pane = new views::View();
pane->SetLayoutManager(

Powered by Google App Engine
This is Rietveld 408576698