| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/options/advanced_contents_view.h" | 5 #include "chrome/browser/views/options/advanced_contents_view.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <cryptuiapi.h> | 9 #include <cryptuiapi.h> |
| 10 #pragma comment(lib, "cryptui.lib") | 10 #pragma comment(lib, "cryptui.lib") |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 SkColor title_color = gfx::NativeTheme::instance()->GetThemeColorWithDefault( | 281 SkColor title_color = gfx::NativeTheme::instance()->GetThemeColorWithDefault( |
| 282 gfx::NativeTheme::BUTTON, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, | 282 gfx::NativeTheme::BUTTON, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, |
| 283 COLOR_WINDOWTEXT); | 283 COLOR_WINDOWTEXT); |
| 284 title_label_->SetColor(title_color); | 284 title_label_->SetColor(title_color); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void AdvancedSection::DidChangeBounds(const gfx::Rect& previous, | 287 void AdvancedSection::DidChangeBounds(const gfx::Rect& previous, |
| 288 const gfx::Rect& current) { | 288 const gfx::Rect& current) { |
| 289 Layout(); | 289 Layout(); |
| 290 contents_->Layout(); | |
| 291 } | 290 } |
| 292 | 291 |
| 293 //////////////////////////////////////////////////////////////////////////////// | 292 //////////////////////////////////////////////////////////////////////////////// |
| 294 // AdvancedSection, protected: | 293 // AdvancedSection, protected: |
| 295 | 294 |
| 296 void AdvancedSection::AddWrappingColumnSet(views::GridLayout* layout, int id) { | 295 void AdvancedSection::AddWrappingColumnSet(views::GridLayout* layout, int id) { |
| 297 ColumnSet* column_set = layout->AddColumnSet(id); | 296 ColumnSet* column_set = layout->AddColumnSet(id); |
| 298 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, | 297 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, |
| 299 GridLayout::USE_PREF, 0, 0); | 298 GridLayout::USE_PREF, 0, 0); |
| 300 } | 299 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 public: | 426 public: |
| 428 explicit PrivacySection(Profile* profile); | 427 explicit PrivacySection(Profile* profile); |
| 429 virtual ~PrivacySection() {} | 428 virtual ~PrivacySection() {} |
| 430 | 429 |
| 431 // Overridden from views::ButtonListener: | 430 // Overridden from views::ButtonListener: |
| 432 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 431 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 433 | 432 |
| 434 // Overridden from views::LinkController: | 433 // Overridden from views::LinkController: |
| 435 virtual void LinkActivated(views::Link* source, int event_flags); | 434 virtual void LinkActivated(views::Link* source, int event_flags); |
| 436 | 435 |
| 437 // Overridden from views::View: | |
| 438 virtual void Layout(); | |
| 439 | |
| 440 protected: | 436 protected: |
| 441 // OptionsPageView overrides: | 437 // OptionsPageView overrides: |
| 442 virtual void InitControlLayout(); | 438 virtual void InitControlLayout(); |
| 443 virtual void NotifyPrefChanged(const std::wstring* pref_name); | 439 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
| 444 | 440 |
| 445 private: | 441 private: |
| 446 // Controls for this section: | 442 // Controls for this section: |
| 447 views::NativeButton* content_settings_button_; | 443 views::NativeButton* content_settings_button_; |
| 448 views::NativeButton* clear_data_button_; | 444 views::NativeButton* clear_data_button_; |
| 449 views::Label* section_description_label_; | 445 views::Label* section_description_label_; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 void PrivacySection::LinkActivated(views::Link* source, int event_flags) { | 538 void PrivacySection::LinkActivated(views::Link* source, int event_flags) { |
| 543 if (source == learn_more_link_) { | 539 if (source == learn_more_link_) { |
| 544 // We open a new browser window so the Options dialog doesn't get lost | 540 // We open a new browser window so the Options dialog doesn't get lost |
| 545 // behind other windows. | 541 // behind other windows. |
| 546 Browser* browser = Browser::Create(profile()); | 542 Browser* browser = Browser::Create(profile()); |
| 547 browser->OpenURL(GURL(l10n_util::GetString(IDS_LEARN_MORE_PRIVACY_URL)), | 543 browser->OpenURL(GURL(l10n_util::GetString(IDS_LEARN_MORE_PRIVACY_URL)), |
| 548 GURL(), NEW_WINDOW, PageTransition::LINK); | 544 GURL(), NEW_WINDOW, PageTransition::LINK); |
| 549 } | 545 } |
| 550 } | 546 } |
| 551 | 547 |
| 552 void PrivacySection::Layout() { | |
| 553 if (reporting_enabled_checkbox_) { | |
| 554 // We override this to try and set the width of the enable logging checkbox | |
| 555 // to the width of the parent less some fudging since the checkbox's | |
| 556 // preferred size calculation code is dependent on its width, and if we | |
| 557 // don't do this then it will return 0 as a preferred width when GridLayout | |
| 558 // (called from View::Layout) tries to access it. | |
| 559 views::View* parent = GetParent(); | |
| 560 if (parent && parent->width()) { | |
| 561 const int parent_width = parent->width(); | |
| 562 reporting_enabled_checkbox_->SetBounds(0, 0, parent_width - 20, 0); | |
| 563 } | |
| 564 } | |
| 565 View::Layout(); | |
| 566 } | |
| 567 | |
| 568 void PrivacySection::InitControlLayout() { | 548 void PrivacySection::InitControlLayout() { |
| 569 AdvancedSection::InitControlLayout(); | 549 AdvancedSection::InitControlLayout(); |
| 570 | 550 |
| 571 content_settings_button_ = new views::NativeButton( | 551 content_settings_button_ = new views::NativeButton( |
| 572 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON)); | 552 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON)); |
| 573 clear_data_button_ = new views::NativeButton( | 553 clear_data_button_ = new views::NativeButton( |
| 574 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON)); | 554 this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON)); |
| 575 section_description_label_ = new views::Label( | 555 section_description_label_ = new views::Label( |
| 576 l10n_util::GetString(IDS_OPTIONS_DISABLE_SERVICES)); | 556 l10n_util::GetString(IDS_OPTIONS_DISABLE_SERVICES)); |
| 577 enable_link_doctor_checkbox_ = new views::Checkbox( | 557 enable_link_doctor_checkbox_ = new views::Checkbox( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 indented_view_set_id, true); | 609 indented_view_set_id, true); |
| 630 // DNS pre-fetching. | 610 // DNS pre-fetching. |
| 631 AddWrappingCheckboxRow(layout, enable_dns_prefetching_checkbox_, | 611 AddWrappingCheckboxRow(layout, enable_dns_prefetching_checkbox_, |
| 632 indented_view_set_id, true); | 612 indented_view_set_id, true); |
| 633 // Safe browsing controls. | 613 // Safe browsing controls. |
| 634 AddWrappingCheckboxRow(layout, enable_safe_browsing_checkbox_, | 614 AddWrappingCheckboxRow(layout, enable_safe_browsing_checkbox_, |
| 635 indented_view_set_id, | 615 indented_view_set_id, |
| 636 reporting_enabled_checkbox_ != NULL); | 616 reporting_enabled_checkbox_ != NULL); |
| 637 // The "Help make Google Chrome better" checkbox. | 617 // The "Help make Google Chrome better" checkbox. |
| 638 if (reporting_enabled_checkbox_) { | 618 if (reporting_enabled_checkbox_) { |
| 639 AddLeadingControl(layout, reporting_enabled_checkbox_, indented_view_set_id, | 619 AddWrappingCheckboxRow(layout, reporting_enabled_checkbox_, |
| 640 false); | 620 indented_view_set_id, false); |
| 641 } | 621 } |
| 642 | 622 |
| 643 // Init member prefs so we can update the controls if prefs change. | 623 // Init member prefs so we can update the controls if prefs change. |
| 644 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled, | 624 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled, |
| 645 profile()->GetPrefs(), this); | 625 profile()->GetPrefs(), this); |
| 646 use_suggest_.Init(prefs::kSearchSuggestEnabled, | 626 use_suggest_.Init(prefs::kSearchSuggestEnabled, |
| 647 profile()->GetPrefs(), this); | 627 profile()->GetPrefs(), this); |
| 648 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled, | 628 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled, |
| 649 profile()->GetPrefs(), this); | 629 profile()->GetPrefs(), this); |
| 650 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile()->GetPrefs(), this); | 630 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile()->GetPrefs(), this); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 //////////////////////////////////////////////////////////////////////////////// | 1394 //////////////////////////////////////////////////////////////////////////////// |
| 1415 // AdvancedScrollViewContainer, views::View overrides: | 1395 // AdvancedScrollViewContainer, views::View overrides: |
| 1416 | 1396 |
| 1417 void AdvancedScrollViewContainer::Layout() { | 1397 void AdvancedScrollViewContainer::Layout() { |
| 1418 gfx::Rect lb = GetLocalBounds(false); | 1398 gfx::Rect lb = GetLocalBounds(false); |
| 1419 | 1399 |
| 1420 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( | 1400 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( |
| 1421 gfx::NativeTheme::LIST); | 1401 gfx::NativeTheme::LIST); |
| 1422 lb.Inset(border.width(), border.height()); | 1402 lb.Inset(border.width(), border.height()); |
| 1423 scroll_view_->SetBounds(lb); | 1403 scroll_view_->SetBounds(lb); |
| 1424 scroll_view_->Layout(); | |
| 1425 } | 1404 } |
| OLD | NEW |