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/policy/configuration_policy_pref_store.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 509 matching lines...) Loading... | |
520 switch (mode_value) { | 520 switch (mode_value) { |
521 case kPolicyNoProxyServerMode: | 521 case kPolicyNoProxyServerMode: |
522 if (server || pac_url || bypass_list) { | 522 if (server || pac_url || bypass_list) { |
523 LOG(WARNING) << "A centrally-administered policy disables the use of" | 523 LOG(WARNING) << "A centrally-administered policy disables the use of" |
524 << " a proxy but also specifies an explicit proxy" | 524 << " a proxy but also specifies an explicit proxy" |
525 << " configuration."; | 525 << " configuration."; |
526 return false; | 526 return false; |
527 } | 527 } |
528 break; | 528 break; |
529 case kPolicyAutoDetectProxyMode: | 529 case kPolicyAutoDetectProxyMode: |
530 if (server || bypass_list) { | 530 if (server || bypass_list) { |
battre
2010/12/28 10:31:39
Here we should check for "|| pac_url" as well
danno
2010/12/28 12:17:54
Done.
| |
531 LOG(WARNING) << "A centrally-administered policy dictates that a proxy" | 531 LOG(WARNING) << "A centrally-administered policy dictates that a proxy" |
532 << " shall be auto configured but specifies fixed proxy" | 532 << " shall be auto configured but specifies fixed proxy" |
533 << " servers or a by-pass list."; | 533 << " servers or a by-pass list."; |
534 return false; | 534 return false; |
535 } | 535 } |
536 break; | 536 break; |
537 case kPolicyManuallyConfiguredProxyMode: | 537 case kPolicyManuallyConfiguredProxyMode: |
538 if (!server) { | 538 if (server && pac_url) { |
539 LOG(WARNING) << "A centrally-administered policy dictates that the" | 539 LOG(WARNING) << "A centrally-administered policy dictates that the" |
540 << " system proxy settings should use fixed proxy servers" | 540 << " system proxy settings should use both a fixed" |
541 << " without specifying which ones."; | 541 << " proxy server and a .pac url."; |
542 return false; | 542 return false; |
543 } | 543 } |
544 if (pac_url) { | 544 if (!server && !pac_url) { |
545 LOG(WARNING) << "A centrally-administered policy dictates that the" | 545 LOG(WARNING) << "A centrally-administered policy dictates that the" |
546 << " system proxy settings should use fixed proxy servers" | 546 << " system proxy settings should use either a fixed" |
547 << " but also specifies a PAC script."; | 547 << " proxy server or a .pac url, but specifies neither."; |
548 return false; | 548 return false; |
549 } | 549 } |
550 break; | 550 break; |
551 case kPolicyUseSystemProxyMode: | 551 case kPolicyUseSystemProxyMode: |
552 if (server || pac_url || bypass_list) { | 552 if (server || pac_url || bypass_list) { |
553 LOG(WARNING) << "A centrally-administered policy dictates that the" | 553 LOG(WARNING) << "A centrally-administered policy dictates that the" |
554 << " system proxy settings should be used but also " | 554 << " system proxy settings should be used but also " |
555 << " specifies an explicit proxy configuration."; | 555 << " specifies an explicit proxy configuration."; |
556 return false; | 556 return false; |
557 } | 557 } |
(...skipping 11 matching lines...) Loading... | |
569 | 569 |
570 int int_mode; | 570 int int_mode; |
571 CHECK(proxy_policies_[kPolicyProxyMode]->GetAsInteger(&int_mode)); | 571 CHECK(proxy_policies_[kPolicyProxyMode]->GetAsInteger(&int_mode)); |
572 ProxyPrefs::ProxyMode mode; | 572 ProxyPrefs::ProxyMode mode; |
573 switch (int_mode) { | 573 switch (int_mode) { |
574 case kPolicyNoProxyServerMode: | 574 case kPolicyNoProxyServerMode: |
575 mode = ProxyPrefs::MODE_DIRECT; | 575 mode = ProxyPrefs::MODE_DIRECT; |
576 break; | 576 break; |
577 case kPolicyAutoDetectProxyMode: | 577 case kPolicyAutoDetectProxyMode: |
578 mode = ProxyPrefs::MODE_AUTO_DETECT; | 578 mode = ProxyPrefs::MODE_AUTO_DETECT; |
579 break; | |
580 case kPolicyManuallyConfiguredProxyMode: | |
581 mode = ProxyPrefs::MODE_FIXED_SERVERS; | |
579 if (HasProxyPolicy(kPolicyProxyPacUrl)) | 582 if (HasProxyPolicy(kPolicyProxyPacUrl)) |
580 mode = ProxyPrefs::MODE_PAC_SCRIPT; | 583 mode = ProxyPrefs::MODE_PAC_SCRIPT; |
581 break; | 584 break; |
582 case kPolicyManuallyConfiguredProxyMode: | |
583 mode = ProxyPrefs::MODE_FIXED_SERVERS; | |
584 break; | |
585 case kPolicyUseSystemProxyMode: | 585 case kPolicyUseSystemProxyMode: |
586 mode = ProxyPrefs::MODE_SYSTEM; | 586 mode = ProxyPrefs::MODE_SYSTEM; |
587 break; | 587 break; |
588 default: | 588 default: |
589 mode = ProxyPrefs::MODE_DIRECT; | 589 mode = ProxyPrefs::MODE_DIRECT; |
590 NOTREACHED(); | 590 NOTREACHED(); |
591 } | 591 } |
592 prefs_.SetValue(prefs::kProxyMode, Value::CreateIntegerValue(mode)); | 592 prefs_.SetValue(prefs::kProxyMode, Value::CreateIntegerValue(mode)); |
593 | 593 |
594 if (HasProxyPolicy(kPolicyProxyServer)) { | 594 if (HasProxyPolicy(kPolicyProxyServer)) { |
(...skipping 301 matching lines...) Loading... | |
896 // Update the initialization flag. | 896 // Update the initialization flag. |
897 if (!initialization_complete_ && | 897 if (!initialization_complete_ && |
898 provider_->IsInitializationComplete()) { | 898 provider_->IsInitializationComplete()) { |
899 initialization_complete_ = true; | 899 initialization_complete_ = true; |
900 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 900 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
901 OnInitializationCompleted()); | 901 OnInitializationCompleted()); |
902 } | 902 } |
903 } | 903 } |
904 | 904 |
905 } // namespace policy | 905 } // namespace policy |
OLD | NEW |