Chromium Code Reviews| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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_append_page( |
|
msw
2012/08/23 21:26:39
s/gtk_notebook_append_page/gtk_notebook_insert_pag
markusheintz_
2012/08/23 22:21:34
Done.
| |
| 327 GTK_NOTEBOOK(notebook), permission_tab_contents, label); | 328 GTK_NOTEBOOK(notebook_), permission_tab_contents, label); |
| 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_append_page(GTK_NOTEBOOK(notebook_), connection_tab, label); |
| 334 | 335 |
| 335 gtk_box_pack_start(GTK_BOX(contents_), notebook, FALSE, FALSE, 0); | 336 gtk_box_pack_start(GTK_BOX(contents_), notebook_, FALSE, FALSE, 0); |
| 336 gtk_widget_show_all(contents_); | 337 gtk_widget_show_all(contents_); |
| 337 } | 338 } |
| 338 | 339 |
| 339 void WebsiteSettingsPopupGtk::OnPermissionChanged( | 340 void WebsiteSettingsPopupGtk::OnPermissionChanged( |
| 340 PermissionSelector* selector) { | 341 PermissionSelector* selector) { |
| 341 presenter_->OnSitePermissionChanged(selector->type(), | 342 presenter_->OnSitePermissionChanged(selector->type(), |
| 342 selector->setting()); | 343 selector->setting()); |
| 343 } | 344 } |
| 344 | 345 |
| 345 void WebsiteSettingsPopupGtk::OnComboboxShown() { | 346 void WebsiteSettingsPopupGtk::OnComboboxShown() { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 selector->AddObserver(this); | 536 selector->AddObserver(this); |
| 536 GtkWidget* hbox = selector->CreateUI(); | 537 GtkWidget* hbox = selector->CreateUI(); |
| 537 selectors_.push_back(selector); | 538 selectors_.push_back(selector); |
| 538 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, | 539 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, |
| 539 FALSE, 0); | 540 FALSE, 0); |
| 540 } | 541 } |
| 541 | 542 |
| 542 gtk_widget_show_all(permissions_section_contents_); | 543 gtk_widget_show_all(permissions_section_contents_); |
| 543 } | 544 } |
| 544 | 545 |
| 546 void WebsiteSettingsPopupGtk::SetSelectedTab(TabId tab_id) { | |
| 547 DCHECK(notebook_); | |
| 548 // The |TabID|s correspond to the indicies used by the notebook widget. | |
| 549 // Therefore |tab_id| can be used directly for setting the current page of | |
| 550 // the |notebook_|. | |
| 551 DCHECK_EQ(TAB_ID_PERMISSIONS, 0); | |
|
msw
2012/08/23 21:26:39
Remove these two DCHECKs.
markusheintz_
2012/08/23 22:21:34
Done.
| |
| 552 DCHECK_EQ(TAB_ID_CONNECTION, 1); | |
| 553 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), | |
| 554 static_cast<gint>(tab_id)); | |
| 555 } | |
| 556 | |
| 545 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { | 557 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { |
| 546 new CollectedCookiesGtk(GTK_WINDOW(parent_), | 558 new CollectedCookiesGtk(GTK_WINDOW(parent_), |
| 547 tab_contents_); | 559 tab_contents_); |
| 548 bubble_->Close(); | 560 bubble_->Close(); |
| 549 } | 561 } |
| 550 | 562 |
| 551 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { | 563 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { |
| 552 DCHECK_NE(cert_id_, 0); | 564 DCHECK_NE(cert_id_, 0); |
| 553 ShowCertificateViewerByID( | 565 ShowCertificateViewerByID( |
| 554 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); | 566 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); |
| 555 bubble_->Close(); | 567 bubble_->Close(); |
| 556 } | 568 } |
| 557 | 569 |
| 558 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) { | 570 void WebsiteSettingsPopupGtk::OnCloseButtonClicked(GtkWidget* widget) { |
| 559 bubble_->Close(); | 571 bubble_->Close(); |
| 560 } | 572 } |
| OLD | NEW |