| OLD | NEW |
| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 profile_(profile), | 202 profile_(profile), |
| 203 tab_contents_(tab_contents), | 203 tab_contents_(tab_contents), |
| 204 browser_(NULL), | 204 browser_(NULL), |
| 205 cert_id_(0), | 205 cert_id_(0), |
| 206 header_box_(NULL), | 206 header_box_(NULL), |
| 207 cookies_section_contents_(NULL), | 207 cookies_section_contents_(NULL), |
| 208 permissions_section_contents_(NULL), | 208 permissions_section_contents_(NULL), |
| 209 identity_contents_(NULL), | 209 identity_contents_(NULL), |
| 210 connection_contents_(NULL), | 210 connection_contents_(NULL), |
| 211 first_visit_contents_(NULL), | 211 first_visit_contents_(NULL), |
| 212 notebook_(NULL), |
| 212 presenter_(NULL) { | 213 presenter_(NULL) { |
| 213 BrowserWindowGtk* browser_window = | 214 BrowserWindowGtk* browser_window = |
| 214 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 215 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
| 215 browser_ = browser_window->browser(); | 216 browser_ = browser_window->browser(); |
| 216 anchor_ = browser_window-> | 217 anchor_ = browser_window-> |
| 217 GetToolbar()->GetLocationBarView()->location_icon_widget(); | 218 GetToolbar()->GetLocationBarView()->location_icon_widget(); |
| 218 | 219 |
| 219 InitContents(); | 220 InitContents(); |
| 220 | 221 |
| 221 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? | 222 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 connection_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); | 300 connection_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 300 gtk_box_pack_start(GTK_BOX(connection_tab), connection_contents_, FALSE, | 301 gtk_box_pack_start(GTK_BOX(connection_tab), connection_contents_, FALSE, |
| 301 FALSE, 0); | 302 FALSE, 0); |
| 302 gtk_box_pack_start(GTK_BOX(connection_tab), gtk_hseparator_new(), FALSE, | 303 gtk_box_pack_start(GTK_BOX(connection_tab), gtk_hseparator_new(), FALSE, |
| 303 FALSE, 0); | 304 FALSE, 0); |
| 304 first_visit_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); | 305 first_visit_contents_ = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 305 gtk_box_pack_start(GTK_BOX(connection_tab), first_visit_contents_, FALSE, | 306 gtk_box_pack_start(GTK_BOX(connection_tab), first_visit_contents_, FALSE, |
| 306 FALSE, 0); | 307 FALSE, 0); |
| 307 | 308 |
| 308 // Create tab container and add all tabs. | 309 // Create tab container and add all tabs. |
| 309 GtkWidget* notebook = gtk_notebook_new(); | 310 notebook_ = gtk_notebook_new(); |
| 310 if (theme_service_->UsingNativeTheme()) | 311 if (theme_service_->UsingNativeTheme()) |
| 311 gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, NULL); | 312 gtk_widget_modify_bg(notebook_, GTK_STATE_NORMAL, NULL); |
| 312 else | 313 else |
| 313 gtk_widget_modify_bg(notebook, GTK_STATE_NORMAL, &kBackgroundColor); | 314 gtk_widget_modify_bg(notebook_, GTK_STATE_NORMAL, &kBackgroundColor); |
| 314 | 315 |
| 315 GtkWidget* label = theme_service_->BuildLabel( | 316 GtkWidget* label = theme_service_->BuildLabel( |
| 316 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), | 317 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), |
| 317 ui::kGdkBlack); | 318 ui::kGdkBlack); |
| 318 gtk_widget_show(label); | 319 gtk_widget_show(label); |
| 319 gtk_notebook_append_page( | 320 gtk_notebook_append_page( |
| 320 GTK_NOTEBOOK(notebook), permission_tab_contents, label); | 321 GTK_NOTEBOOK(notebook_), permission_tab_contents, label); |
| 321 | 322 |
| 322 label = theme_service_->BuildLabel( | 323 label = theme_service_->BuildLabel( |
| 323 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), | 324 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), |
| 324 ui::kGdkBlack); | 325 ui::kGdkBlack); |
| 325 gtk_widget_show(label); | 326 gtk_widget_show(label); |
| 326 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), connection_tab, label); | 327 gtk_notebook_append_page(GTK_NOTEBOOK(notebook_), connection_tab, label); |
| 327 | 328 |
| 328 gtk_box_pack_start(GTK_BOX(contents_), notebook, FALSE, FALSE, 0); | 329 gtk_box_pack_start(GTK_BOX(contents_), notebook_, FALSE, FALSE, 0); |
| 329 gtk_widget_show_all(contents_); | 330 gtk_widget_show_all(contents_); |
| 330 } | 331 } |
| 331 | 332 |
| 332 void WebsiteSettingsPopupGtk::OnPermissionChanged( | 333 void WebsiteSettingsPopupGtk::OnPermissionChanged( |
| 333 PermissionSelector* selector) { | 334 PermissionSelector* selector) { |
| 334 presenter_->OnSitePermissionChanged(selector->type(), | 335 presenter_->OnSitePermissionChanged(selector->type(), |
| 335 selector->setting()); | 336 selector->setting()); |
| 336 } | 337 } |
| 337 | 338 |
| 338 void WebsiteSettingsPopupGtk::OnComboboxShown() { | 339 void WebsiteSettingsPopupGtk::OnComboboxShown() { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 selector->AddObserver(this); | 516 selector->AddObserver(this); |
| 516 GtkWidget* hbox = selector->CreateUI(); | 517 GtkWidget* hbox = selector->CreateUI(); |
| 517 selectors_.push_back(selector); | 518 selectors_.push_back(selector); |
| 518 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, | 519 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, |
| 519 FALSE, 0); | 520 FALSE, 0); |
| 520 } | 521 } |
| 521 | 522 |
| 522 gtk_widget_show_all(permissions_section_contents_); | 523 gtk_widget_show_all(permissions_section_contents_); |
| 523 } | 524 } |
| 524 | 525 |
| 526 void WebsiteSettingsPopupGtk::SetSelectedTab(TabId tab_id) { |
| 527 DCHECK(notebook_); |
| 528 // The |TabID|s correspond to the indicies used by the notebook widget. |
| 529 // Therefore |tab_id| can be used directly for setting the current page of |
| 530 // the |notebook_|. |
| 531 DCHECK_EQ(TAB_ID_PERMISSIONS, 0); |
| 532 DCHECK_EQ(TAB_ID_CONNECTION, 1); |
| 533 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), |
| 534 static_cast<gint>(tab_id)); |
| 535 } |
| 536 |
| 525 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { | 537 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { |
| 526 new CollectedCookiesGtk(GTK_WINDOW(parent_), | 538 new CollectedCookiesGtk(GTK_WINDOW(parent_), |
| 527 tab_contents_); | 539 tab_contents_); |
| 528 bubble_->Close(); | 540 bubble_->Close(); |
| 529 } | 541 } |
| 530 | 542 |
| 531 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { | 543 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { |
| 532 DCHECK_NE(cert_id_, 0); | 544 DCHECK_NE(cert_id_, 0); |
| 533 ShowCertificateViewerByID( | 545 ShowCertificateViewerByID( |
| 534 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); | 546 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); |
| 535 bubble_->Close(); | 547 bubble_->Close(); |
| 536 } | 548 } |
| OLD | NEW |