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

Side by Side Diff: chrome/browser/ui/gtk/website_settings/website_settings_popup_gtk.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: Fix build issues. 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/gtk/website_settings/website_settings_popup_gtk.h" 5 #include "chrome/browser/ui/gtk/website_settings/website_settings_popup_gtk.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/certificate_viewer.h" 10 #include "chrome/browser/certificate_viewer.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 profile_(profile), 209 profile_(profile),
210 tab_contents_(tab_contents), 210 tab_contents_(tab_contents),
211 browser_(NULL), 211 browser_(NULL),
212 cert_id_(0), 212 cert_id_(0),
213 header_box_(NULL), 213 header_box_(NULL),
214 cookies_section_contents_(NULL), 214 cookies_section_contents_(NULL),
215 permissions_section_contents_(NULL), 215 permissions_section_contents_(NULL),
216 identity_contents_(NULL), 216 identity_contents_(NULL),
217 connection_contents_(NULL), 217 connection_contents_(NULL),
218 first_visit_contents_(NULL), 218 first_visit_contents_(NULL),
219 notebook_(NULL),
219 presenter_(NULL) { 220 presenter_(NULL) {
220 BrowserWindowGtk* browser_window = 221 BrowserWindowGtk* browser_window =
221 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); 222 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent);
222 browser_ = browser_window->browser(); 223 browser_ = browser_window->browser();
223 anchor_ = browser_window-> 224 anchor_ = browser_window->
224 GetToolbar()->GetLocationBarView()->location_icon_widget(); 225 GetToolbar()->GetLocationBarView()->location_icon_widget();
225 226
226 InitContents(); 227 InitContents();
227 228
228 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? 229 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ?
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 connection_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); 307 connection_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
307 gtk_box_pack_start(GTK_BOX(connection_tab), connection_contents_, FALSE, 308 gtk_box_pack_start(GTK_BOX(connection_tab), connection_contents_, FALSE,
308 FALSE, 0); 309 FALSE, 0);
309 gtk_box_pack_start(GTK_BOX(connection_tab), gtk_hseparator_new(), FALSE, 310 gtk_box_pack_start(GTK_BOX(connection_tab), gtk_hseparator_new(), FALSE,
310 FALSE, 0); 311 FALSE, 0);
311 first_visit_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); 312 first_visit_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing);
312 gtk_box_pack_start(GTK_BOX(connection_tab), first_visit_contents_, FALSE, 313 gtk_box_pack_start(GTK_BOX(connection_tab), first_visit_contents_, FALSE,
313 FALSE, 0); 314 FALSE, 0);
314 315
315 // Create tab container and add all tabs. 316 // Create tab container and add all tabs.
316 GtkWidget* notebook = gtk_notebook_new(); 317 notebook_ = gtk_notebook_new();
317 if (theme_service_->UsingNativeTheme()) 318 if (theme_service_->UsingNativeTheme())
318 gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, NULL); 319 gtk_widget_modify_bg(notebook_, GTK_STATE_NORMAL, NULL);
319 else 320 else
320 gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, &kBackgroundColor); 321 gtk_widget_modify_bg(notebook_, GTK_STATE_NORMAL, &kBackgroundColor);
321 322
322 GtkWidget* label = theme_service_->BuildLabel( 323 GtkWidget* label = theme_service_->BuildLabel(
323 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), 324 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS),
324 ui::kGdkBlack); 325 ui::kGdkBlack);
325 gtk_widget_show(label); 326 gtk_widget_show(label);
326 gtk_notebook_append_page( 327 gtk_notebook_insert_page(GTK_NOTEBOOK(notebook_), permission_tab_contents,
327 GTK_NOTEBOOK(notebook), permission_tab_contents, label); 328 label, TAB_ID_PERMISSIONS);
328 329
329 label = theme_service_->BuildLabel( 330 label = theme_service_->BuildLabel(
330 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), 331 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION),
331 ui::kGdkBlack); 332 ui::kGdkBlack);
332 gtk_widget_show(label); 333 gtk_widget_show(label);
333 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), connection_tab, label); 334 gtk_notebook_insert_page(GTK_NOTEBOOK(notebook_), connection_tab, label,
335 TAB_ID_CONNECTION);
334 336
335 gtk_box_pack_start(GTK_BOX(contents_), notebook, FALSE, FALSE, 0); 337 DCHECK_EQ(gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook_)), NUM_TAB_IDS);
338
339 gtk_box_pack_start(GTK_BOX(contents_), notebook_, FALSE, FALSE, 0);
336 gtk_widget_show_all(contents_); 340 gtk_widget_show_all(contents_);
337 } 341 }
338 342
339 void WebsiteSettingsPopupGtk::OnPermissionChanged( 343 void WebsiteSettingsPopupGtk::OnPermissionChanged(
340 PermissionSelector* selector) { 344 PermissionSelector* selector) {
341 presenter_->OnSitePermissionChanged(selector->type(), 345 presenter_->OnSitePermissionChanged(selector->type(),
342 selector->setting()); 346 selector->setting());
343 } 347 }
344 348
345 void WebsiteSettingsPopupGtk::OnComboboxShown() { 349 void WebsiteSettingsPopupGtk::OnComboboxShown() {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 selector->AddObserver(this); 539 selector->AddObserver(this);
536 GtkWidget* hbox = selector->CreateUI(); 540 GtkWidget* hbox = selector->CreateUI();
537 selectors_.push_back(selector); 541 selectors_.push_back(selector);
538 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, 542 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE,
539 FALSE, 0); 543 FALSE, 0);
540 } 544 }
541 545
542 gtk_widget_show_all(permissions_section_contents_); 546 gtk_widget_show_all(permissions_section_contents_);
543 } 547 }
544 548
549 void WebsiteSettingsPopupGtk::SetSelectedTab(TabId tab_id) {
550 DCHECK(notebook_);
551 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_),
552 static_cast<gint>(tab_id));
553 }
554
545 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { 555 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) {
546 new CollectedCookiesGtk(GTK_WINDOW(parent_), 556 new CollectedCookiesGtk(GTK_WINDOW(parent_),
547 tab_contents_); 557 tab_contents_);
548 bubble_->Close(); 558 bubble_->Close();
549 } 559 }
550 560
551 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { 561 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) {
552 DCHECK_NE(cert_id_, 0); 562 DCHECK_NE(cert_id_, 0);
553 ShowCertificateViewerByID( 563 ShowCertificateViewerByID(
554 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); 564 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_);
555 bubble_->Close(); 565 bubble_->Close();
556 } 566 }
557 567
558 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) { 568 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) {
559 bubble_->Close(); 569 bubble_->Close();
560 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698