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

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: Address comments (msw). Created 8 years, 3 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);
324 tabbed_pane_->set_listener(this); 327 tabbed_pane_->set_listener(this);
325 328
326 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, 329 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft,
327 kPopupMarginBottom, kPopupMarginRight)); 330 kPopupMarginBottom, kPopupMarginRight));
328 331
329 views::BubbleDelegateView::CreateBubble(this); 332 views::BubbleDelegateView::CreateBubble(this);
330 this->Show(); 333 this->Show();
331 SizeToContents(); 334 SizeToContents();
332 335
333 presenter_.reset(new WebsiteSettings(this, profile, 336 presenter_.reset(new WebsiteSettings(this, profile,
(...skipping 22 matching lines...) Expand all
356 GetWidget()->Close(); 359 GetWidget()->Close();
357 } 360 }
358 361
359 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, 362 void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
360 int event_flags) { 363 int event_flags) {
361 if (source == cookie_dialog_link_) { 364 if (source == cookie_dialog_link_) {
362 new CollectedCookiesViews(tab_contents_); 365 new CollectedCookiesViews(tab_contents_);
363 } else if (source == certificate_dialog_link_) { 366 } else if (source == certificate_dialog_link_) {
364 gfx::NativeWindow parent = 367 gfx::NativeWindow parent =
365 anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL; 368 anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL;
366 ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_); 369 ShowCertificateViewerByID(tab_contents_->web_contents(), parent, cert_id_);
367 } 370 }
368 // The popup closes automatically when the collected cookies dialog or the 371 // The popup closes automatically when the collected cookies dialog or the
369 // certificate viewer opens. 372 // certificate viewer opens.
370 } 373 }
371 374
372 void WebsiteSettingsPopupView::TabSelectedAt(int index) { 375 void WebsiteSettingsPopupView::TabSelectedAt(int index) {
373 tabbed_pane_->GetSelectedTab()->Layout(); 376 tabbed_pane_->GetSelectedTab()->Layout();
374 SizeToContents(); 377 SizeToContents();
375 } 378 }
376 379
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 UTF8ToUTF16(identity_info.identity_status_description), 518 UTF8ToUTF16(identity_info.identity_status_description),
516 certificate_dialog_link_); 519 certificate_dialog_link_);
517 520
518 ResetConnectionSection( 521 ResetConnectionSection(
519 connection_info_content_, 522 connection_info_content_,
520 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status), 523 WebsiteSettingsUI::GetConnectionIcon(identity_info.connection_status),
521 string16(), // The connection section has no headline. 524 string16(), // The connection section has no headline.
522 UTF8ToUTF16(identity_info.connection_status_description), 525 UTF8ToUTF16(identity_info.connection_status_description),
523 NULL); 526 NULL);
524 527
525 Layout(); 528 // TODO(markusheintz): This is a hack to resize the connection tab contents
526 SizeToContents(); 529 // correctly. If this is not done, then the connection tab does not disaply
530 // its contents correctly in case it is selected as visible tab when the
531 // |WebsiteSettingsPopupView| is opened. Fix this.
532 int tab_index = tabbed_pane_->GetSelectedTabIndex();
533 tabbed_pane_->SelectTabAt(0);
534 tabbed_pane_->SelectTabAt(1);
535 tabbed_pane_->SelectTabAt(tab_index);
527 } 536 }
528 537
529 void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) { 538 void WebsiteSettingsPopupView::SetFirstVisit(const string16& first_visit) {
530 ResetConnectionSection( 539 ResetConnectionSection(
531 page_info_content_, 540 page_info_content_,
532 WebsiteSettingsUI::GetFirstVisitIcon(first_visit), 541 WebsiteSettingsUI::GetFirstVisitIcon(first_visit),
533 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE), 542 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE),
534 first_visit, 543 first_visit,
535 NULL); 544 NULL);
536 Layout(); 545 Layout();
537 SizeToContents(); 546 SizeToContents();
538 } 547 }
539 548
549 void WebsiteSettingsPopupView::SetSelectedTab(TabId tab_id) {
550 tabbed_pane_->SelectTabAt(tab_id);
551 }
552
540 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() { 553 views::View* WebsiteSettingsPopupView::CreatePermissionsTab() {
541 views::View* pane = new views::View(); 554 views::View* pane = new views::View();
542 pane->SetLayoutManager( 555 pane->SetLayoutManager(
543 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); 556 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
544 // Add cookies and site data section. 557 // Add cookies and site data section.
545 cookie_dialog_link_ = new views::Link( 558 cookie_dialog_link_ = new views::Link(
546 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA)); 559 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA));
547 cookie_dialog_link_->set_listener(this); 560 cookie_dialog_link_->set_listener(this);
548 site_data_content_ = new views::View(); 561 site_data_content_ = new views::View();
549 views::View* site_data_section = 562 views::View* site_data_section =
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 707
695 if (link) { 708 if (link) {
696 content_layout->StartRow(1, 0); 709 content_layout->StartRow(1, 0);
697 content_layout->AddView(link); 710 content_layout->AddView(link);
698 } 711 }
699 712
700 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, 713 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING,
701 views::GridLayout::LEADING); 714 views::GridLayout::LEADING);
702 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); 715 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom);
703 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698