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

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: Address comments (msw). 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/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 gtk_box_pack_start(GTK_BOX(contents_), notebook_, FALSE, FALSE, 0);
336 gtk_widget_show_all(contents_); 338 gtk_widget_show_all(contents_);
337 } 339 }
338 340
339 void WebsiteSettingsPopupGtk::OnPermissionChanged( 341 void WebsiteSettingsPopupGtk::OnPermissionChanged(
340 PermissionSelector* selector) { 342 PermissionSelector* selector) {
341 presenter_->OnSitePermissionChanged(selector->type(), 343 presenter_->OnSitePermissionChanged(selector->type(),
342 selector->setting()); 344 selector->setting());
343 } 345 }
344 346
345 void WebsiteSettingsPopupGtk::OnComboboxShown() { 347 void WebsiteSettingsPopupGtk::OnComboboxShown() {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 selector->AddObserver(this); 537 selector->AddObserver(this);
536 GtkWidget* hbox = selector->CreateUI(); 538 GtkWidget* hbox = selector->CreateUI();
537 selectors_.push_back(selector); 539 selectors_.push_back(selector);
538 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, 540 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE,
539 FALSE, 0); 541 FALSE, 0);
540 } 542 }
541 543
542 gtk_widget_show_all(permissions_section_contents_); 544 gtk_widget_show_all(permissions_section_contents_);
543 } 545 }
544 546
547 void WebsiteSettingsPopupGtk::SetSelectedTab(TabId tab_id) {
548 DCHECK(notebook_);
549 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_),
550 static_cast<gint>(tab_id));
551 }
552
545 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { 553 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) {
546 new CollectedCookiesGtk(GTK_WINDOW(parent_), 554 new CollectedCookiesGtk(GTK_WINDOW(parent_),
547 tab_contents_); 555 tab_contents_);
548 bubble_->Close(); 556 bubble_->Close();
549 } 557 }
550 558
551 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { 559 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) {
552 DCHECK_NE(cert_id_, 0); 560 DCHECK_NE(cert_id_, 0);
553 ShowCertificateViewerByID( 561 ShowCertificateViewerByID(
554 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); 562 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_);
555 bubble_->Close(); 563 bubble_->Close();
556 } 564 }
557 565
558 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) { 566 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) {
559 bubble_->Close(); 567 bubble_->Close();
560 } 568 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698