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

Side by Side 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: " 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
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 "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h "
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/certificate_viewer.h" 9 #include "chrome/browser/certificate_viewer.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 layout->AddView(header_); 306 layout->AddView(header_);
307 307
308 layout->AddPaddingRow(1, kHeaderMarginBottom); 308 layout->AddPaddingRow(1, kHeaderMarginBottom);
309 tabbed_pane_ = new views::TabbedPane(); 309 tabbed_pane_ = new views::TabbedPane();
310 layout->StartRow(1, content_column); 310 layout->StartRow(1, content_column);
311 layout->AddView(tabbed_pane_); 311 layout->AddView(tabbed_pane_);
312 // Tabs must be added after the tabbed_pane_ was added to the views 312 // Tabs must be added after the tabbed_pane_ was added to the views
313 // hierachy. Adding the |tabbed_pane_| to the views hierachy triggers the 313 // hierachy. Adding the |tabbed_pane_| to the views hierachy triggers the
314 // initialization of the native tab UI element. If the native tab UI 314 // initialization of the native tab UI element. If the native tab UI
315 // element is not initalized adding a tab will result in a NULL pointer 315 // element is not initalized adding a tab will result in a NULL pointer
316 // excetion. 316 // exception.
317 tabbed_pane_->AddTab( 317 tabbed_pane_->AddTabAtIndex(
318 TAB_ID_PERMISSIONS,
318 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), 319 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS),
319 CreatePermissionsTab()); 320 CreatePermissionsTab(),
320 tabbed_pane_->AddTab( 321 true);
322 tabbed_pane_->AddTabAtIndex(
323 TAB_ID_CONNECTION,
321 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), 324 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION),
322 CreateConnectionTab()); 325 CreateConnectionTab(),
323 tabbed_pane_->SelectTabAt(0); 326 true);
327 DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS);
324 tabbed_pane_->set_listener(this); 328 tabbed_pane_->set_listener(this);
325 329
326 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, 330 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft,
327 kPopupMarginBottom, kPopupMarginRight)); 331 kPopupMarginBottom, kPopupMarginRight));
328 332
329 views::BubbleDelegateView::CreateBubble(this); 333 views::BubbleDelegateView::CreateBubble(this);
330 this->Show(); 334 this->Show();
331 SizeToContents(); 335 SizeToContents();
332 336
333 presenter_.reset(new WebsiteSettings(this, profile, 337 presenter_.reset(new WebsiteSettings(this, profile,
(...skipping 22 matching lines...) Expand all
356 GetWidget()->Close(); 360 GetWidget()->Close();
357 } 361 }
358 362
359 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, 363 void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
360 int event_flags) { 364 int event_flags) {
361 if (source == cookie_dialog_link_) { 365 if (source == cookie_dialog_link_) {
362 new CollectedCookiesViews(tab_contents_); 366 new CollectedCookiesViews(tab_contents_);
363 } else if (source == certificate_dialog_link_) { 367 } else if (source == certificate_dialog_link_) {
364 gfx::NativeWindow parent = 368 gfx::NativeWindow parent =
365 anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL; 369 anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL;
366 ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_); 370 ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_);
367 } 371 }
368 // The popup closes automatically when the collected cookies dialog or the 372 // The popup closes automatically when the collected cookies dialog or the
369 // certificate viewer opens. 373 // certificate viewer opens.
370 } 374 }
371 375
372 void WebsiteSettingsPopupView::TabSelectedAt(int index) { 376 void WebsiteSettingsPopupView::TabSelectedAt(int index) {
373 tabbed_pane_->GetSelectedTab()->Layout(); 377 tabbed_pane_->GetSelectedTab()->Layout();
374 SizeToContents(); 378 SizeToContents();
375 } 379 }
376 380
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 UTF8ToUTF16(identity_info.identity_status_description), 519 UTF8ToUTF16(identity_info.identity_status_description),
516 certificate_dialog_link_); 520 certificate_dialog_link_);
517 521
518 ResetConnectionSection( 522 ResetConnectionSection(
519 connection_info_content_, 523 connection_info_content_,
520 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), 524 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status),
521 string16(), // The connection section has no headline. 525 string16(), // The connection section has no headline.
522 UTF8ToUTF16(identity_info.connection_status_description), 526 UTF8ToUTF16(identity_info.connection_status_description),
523 NULL); 527 NULL);
524 528
525 Layout(); 529 // TODO(markusheintz): This is a hack to resize the connection tab contents
msw 2012/08/24 18:56:40 Remove this and use InvalidateLayout instead.
markusheintz_ 2012/08/27 09:09:30 Done.
526 SizeToContents(); 530 // correctly. If this is not done, then the connection tab does not disaply
531 // its contents correctly in case it is selected as visible tab when the
532 // |WebsiteSettingsPopupView| is opened. Fix this.
533 int tab_index = tabbed_pane_->GetSelectedTabIndex();
534 tabbed_pane_->SelectTabAt(0);
535 tabbed_pane_->SelectTabAt(1);
536 tabbed_pane_->SelectTabAt(tab_index);
527 } 537 }
528 538
529 void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) { 539 void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) {
530 ResetConnectionSection( 540 ResetConnectionSection(
531 page_info_content_, 541 page_info_content_,
532 WebsiteSettingsUI::GetFirstVisitIcon(first_visit), 542 WebsiteSettingsUI::GetFirstVisitIcon(first_visit),
533 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE), 543 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE),
534 first_visit, 544 first_visit,
535 NULL); 545 NULL);
536 Layout(); 546 Layout();
537 SizeToContents(); 547 SizeToContents();
538 } 548 }
539 549
550 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) {
551 tabbed_pane_->SelectTabAt(tab_id);
552 }
553
540 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() { 554 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() {
541 views::View* pane = new views::View(); 555 views::View* pane = new views::View();
542 pane->SetLayoutManager( 556 pane->SetLayoutManager(
543 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 557 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
544 // Add cookies and site data section. 558 // Add cookies and site data section.
545 cookie_dialog_link_ = new views::Link( 559 cookie_dialog_link_ = new views::Link(
546 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA)); 560 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA));
547 cookie_dialog_link_->set_listener(this); 561 cookie_dialog_link_->set_listener(this);
548 site_data_content_ = new views::View(); 562 site_data_content_ = new views::View();
549 views::View* site_data_section = 563 views::View* site_data_section =
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 708
695 if (link) { 709 if (link) {
696 content_layout->StartRow(1, 0); 710 content_layout->StartRow(1, 0);
697 content_layout->AddView(link); 711 content_layout->AddView(link);
698 } 712 }
699 713
700 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, 714 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING,
701 views::GridLayout::LEADING); 715 views::GridLayout::LEADING);
702 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); 716 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom);
703 } 717 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698