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

Side by Side Diff: chrome/browser/views/options/advanced_contents_view.cc

Issue 556095: Changes to support new cookie policy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | net/base/cookie_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 #include "chrome/browser/views/options/fonts_languages_window_view.h" 37 #include "chrome/browser/views/options/fonts_languages_window_view.h"
38 #include "chrome/browser/views/restart_message_box.h" 38 #include "chrome/browser/views/restart_message_box.h"
39 #include "chrome/common/pref_member.h" 39 #include "chrome/common/pref_member.h"
40 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
41 #include "chrome/common/pref_service.h" 41 #include "chrome/common/pref_service.h"
42 #include "grit/app_resources.h" 42 #include "grit/app_resources.h"
43 #include "grit/chromium_strings.h" 43 #include "grit/chromium_strings.h"
44 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
45 #include "grit/locale_settings.h" 45 #include "grit/locale_settings.h"
46 #include "net/base/ssl_config_service_win.h" 46 #include "net/base/ssl_config_service_win.h"
47 #include "net/base/cookie_policy.h"
48 #include "skia/ext/skia_utils_win.h" 47 #include "skia/ext/skia_utils_win.h"
49 #include "third_party/skia/include/core/SkBitmap.h" 48 #include "third_party/skia/include/core/SkBitmap.h"
50 #include "views/background.h" 49 #include "views/background.h"
51 #include "views/controls/button/checkbox.h" 50 #include "views/controls/button/checkbox.h"
52 #include "views/controls/combobox/combobox.h" 51 #include "views/controls/combobox/combobox.h"
53 #include "views/controls/scroll_view.h" 52 #include "views/controls/scroll_view.h"
54 #include "views/controls/textfield/textfield.h" 53 #include "views/controls/textfield/textfield.h"
55 #include "views/grid_layout.h" 54 #include "views/grid_layout.h"
56 #include "views/standard_layout.h" 55 #include "views/standard_layout.h"
57 #include "views/widget/widget.h" 56 #include "views/widget/widget.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 layout->StartRow(0, single_column_layout_id); 433 layout->StartRow(0, single_column_layout_id);
435 layout->AddView(title_label_); 434 layout->AddView(title_label_);
436 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 435 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
437 layout->StartRow(0, inset_column_layout_id); 436 layout->StartRow(0, inset_column_layout_id);
438 layout->AddView(contents_); 437 layout->AddView(contents_);
439 } 438 }
440 439
441 //////////////////////////////////////////////////////////////////////////////// 440 ////////////////////////////////////////////////////////////////////////////////
442 // PrivacySection 441 // PrivacySection
443 442
444 class CookieBehaviorComboModel : public ComboboxModel {
445 public:
446 CookieBehaviorComboModel() {}
447
448 // Return the number of items in the combo box.
449 virtual int GetItemCount() {
450 return 3;
451 }
452
453 virtual std::wstring GetItemAt(int index) {
454 const int kStringIDs[] = {
455 IDS_OPTIONS_COOKIES_ACCEPT_ALL_COOKIES,
456 IDS_OPTIONS_COOKIES_RESTRICT_THIRD_PARTY_COOKIES,
457 IDS_OPTIONS_COOKIES_BLOCK_ALL_COOKIES
458 };
459 if (index >= 0 && index < arraysize(kStringIDs))
460 return l10n_util::GetString(kStringIDs[index]);
461
462 NOTREACHED();
463 return L"";
464 }
465
466 static int CookiePolicyToIndex(net::CookiePolicy::Type policy) {
467 return policy;
468 }
469
470 static net::CookiePolicy::Type IndexToCookiePolicy(int index) {
471 if (net::CookiePolicy::ValidType(index))
472 return net::CookiePolicy::FromInt(index);
473
474 NOTREACHED();
475 return net::CookiePolicy::ALLOW_ALL_COOKIES;
476 }
477
478 private:
479 DISALLOW_COPY_AND_ASSIGN(CookieBehaviorComboModel);
480 };
481
482 class PrivacySection : public AdvancedSection, 443 class PrivacySection : public AdvancedSection,
483 public views::ButtonListener, 444 public views::ButtonListener,
484 public views::LinkController { 445 public views::LinkController {
485 public: 446 public:
486 explicit PrivacySection(Profile* profile); 447 explicit PrivacySection(Profile* profile);
487 virtual ~PrivacySection() {} 448 virtual ~PrivacySection() {}
488 449
489 // Overridden from views::ButtonListener: 450 // Overridden from views::ButtonListener:
490 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 451 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
491 452
(...skipping 13 matching lines...) Expand all
505 views::NativeButton* content_settings_button_; 466 views::NativeButton* content_settings_button_;
506 views::NativeButton* clear_data_button_; 467 views::NativeButton* clear_data_button_;
507 views::Label* section_description_label_; 468 views::Label* section_description_label_;
508 views::Checkbox* enable_link_doctor_checkbox_; 469 views::Checkbox* enable_link_doctor_checkbox_;
509 views::Checkbox* enable_suggest_checkbox_; 470 views::Checkbox* enable_suggest_checkbox_;
510 views::Checkbox* enable_dns_prefetching_checkbox_; 471 views::Checkbox* enable_dns_prefetching_checkbox_;
511 views::Checkbox* enable_safe_browsing_checkbox_; 472 views::Checkbox* enable_safe_browsing_checkbox_;
512 views::Checkbox* reporting_enabled_checkbox_; 473 views::Checkbox* reporting_enabled_checkbox_;
513 views::Link* learn_more_link_; 474 views::Link* learn_more_link_;
514 475
515 // Dummy for now. Used to populate cookies models.
516 scoped_ptr<CookieBehaviorComboModel> allow_cookies_model_;
517
518 // Preferences for this section: 476 // Preferences for this section:
519 BooleanPrefMember alternate_error_pages_; 477 BooleanPrefMember alternate_error_pages_;
520 BooleanPrefMember use_suggest_; 478 BooleanPrefMember use_suggest_;
521 BooleanPrefMember dns_prefetch_enabled_; 479 BooleanPrefMember dns_prefetch_enabled_;
522 BooleanPrefMember safe_browsing_; 480 BooleanPrefMember safe_browsing_;
523 BooleanPrefMember enable_metrics_recording_; 481 BooleanPrefMember enable_metrics_recording_;
524 482
525 void ResolveMetricsReportingEnabled(); 483 void ResolveMetricsReportingEnabled();
526 484
527 DISALLOW_COPY_AND_ASSIGN(PrivacySection); 485 DISALLOW_COPY_AND_ASSIGN(PrivacySection);
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 1346
1389 void AdvancedScrollViewContainer::Layout() { 1347 void AdvancedScrollViewContainer::Layout() {
1390 gfx::Rect lb = GetLocalBounds(false); 1348 gfx::Rect lb = GetLocalBounds(false);
1391 1349
1392 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( 1350 gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize(
1393 gfx::NativeTheme::LIST); 1351 gfx::NativeTheme::LIST);
1394 lb.Inset(border.width(), border.height()); 1352 lb.Inset(border.width(), border.height());
1395 scroll_view_->SetBounds(lb); 1353 scroll_view_->SetBounds(lb);
1396 scroll_view_->Layout(); 1354 scroll_view_->Layout();
1397 } 1355 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | net/base/cookie_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698