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 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); |
| 322 tab_id_index_map_[TAB_ID_PERMISSIONS] = 0; | |
| 321 | 323 |
| 322 label = theme_service_->BuildLabel( | 324 label = theme_service_->BuildLabel( |
| 323 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), | 325 l10n_util::GetStringUTF8(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), |
| 324 ui::kGdkBlack); | 326 ui::kGdkBlack); |
| 325 gtk_widget_show(label); | 327 gtk_widget_show(label); |
| 326 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), connection_tab, label); | 328 gtk_notebook_append_page(GTK_NOTEBOOK(notebook_), connection_tab, label); |
| 329 tab_id_index_map_[TAB_ID_CONNECTION] = 1; | |
| 327 | 330 |
| 328 gtk_box_pack_start(GTK_BOX(contents_), notebook, FALSE, FALSE, 0); | 331 gtk_box_pack_start(GTK_BOX(contents_), notebook_, FALSE, FALSE, 0); |
| 329 gtk_widget_show_all(contents_); | 332 gtk_widget_show_all(contents_); |
| 330 } | 333 } |
| 331 | 334 |
| 332 void WebsiteSettingsPopupGtk::OnPermissionChanged( | 335 void WebsiteSettingsPopupGtk::OnPermissionChanged( |
| 333 PermissionSelector* selector) { | 336 PermissionSelector* selector) { |
| 334 presenter_->OnSitePermissionChanged(selector->type(), | 337 presenter_->OnSitePermissionChanged(selector->type(), |
| 335 selector->setting()); | 338 selector->setting()); |
| 336 } | 339 } |
| 337 | 340 |
| 338 void WebsiteSettingsPopupGtk::OnComboboxShown() { | 341 void WebsiteSettingsPopupGtk::OnComboboxShown() { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 selector->AddObserver(this); | 518 selector->AddObserver(this); |
| 516 GtkWidget* hbox = selector->CreateUI(); | 519 GtkWidget* hbox = selector->CreateUI(); |
| 517 selectors_.push_back(selector); | 520 selectors_.push_back(selector); |
| 518 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, | 521 gtk_box_pack_start(GTK_BOX(permissions_section_contents_), hbox, FALSE, |
| 519 FALSE, 0); | 522 FALSE, 0); |
| 520 } | 523 } |
| 521 | 524 |
| 522 gtk_widget_show_all(permissions_section_contents_); | 525 gtk_widget_show_all(permissions_section_contents_); |
| 523 } | 526 } |
| 524 | 527 |
| 528 void WebsiteSettingsPopupGtk::SetSelectedTab(TabId tab_id) { | |
| 529 DCHECK(notebook_); | |
| 530 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), | |
| 531 tab_id_index_map_[tab_id]); | |
|
markusheintz_
2012/08/21 17:07:07
@erg: I wonder whether I'm not over complicating t
Elliot Glaysher
2012/08/21 17:12:36
I'm fine with that, but add DCHECKs to make sure t
markusheintz_
2012/08/21 17:22:54
Done. Also added a comment.
| |
| 532 } | |
| 533 | |
| 525 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { | 534 void WebsiteSettingsPopupGtk::OnCookiesLinkClicked(GtkWidget* widget) { |
| 526 new CollectedCookiesGtk(GTK_WINDOW(parent_), | 535 new CollectedCookiesGtk(GTK_WINDOW(parent_), |
| 527 tab_contents_); | 536 tab_contents_); |
| 528 bubble_->Close(); | 537 bubble_->Close(); |
| 529 } | 538 } |
| 530 | 539 |
| 531 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { | 540 void WebsiteSettingsPopupGtk::OnViewCertLinkClicked(GtkWidget* widget) { |
| 532 DCHECK_NE(cert_id_, 0); | 541 DCHECK_NE(cert_id_, 0); |
| 533 ShowCertificateViewerByID( | 542 ShowCertificateViewerByID( |
| 534 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); | 543 tab_contents_->web_contents(), GTK_WINDOW(parent_), cert_id_); |
| 535 bubble_->Close(); | 544 bubble_->Close(); |
| 536 } | 545 } |
| OLD | NEW |