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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2395763003: Do not white list offline archive directory (Closed)
Patch Set: Removed unneeded include file Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/offline_pages/offline_internals.js » ('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) 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/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "chrome/browser/browser_process.h" 29 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/content_settings/cookie_settings_factory.h" 30 #include "chrome/browser/content_settings/cookie_settings_factory.h"
31 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 31 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
33 #include "chrome/browser/net/chrome_extensions_network_delegate.h" 33 #include "chrome/browser/net/chrome_extensions_network_delegate.h"
34 #include "chrome/browser/net/request_source_bandwidth_histograms.h" 34 #include "chrome/browser/net/request_source_bandwidth_histograms.h"
35 #include "chrome/browser/net/safe_search_util.h" 35 #include "chrome/browser/net/safe_search_util.h"
36 #include "chrome/browser/profiles/profile_manager.h" 36 #include "chrome/browser/profiles/profile_manager.h"
37 #include "chrome/browser/task_manager/task_manager_interface.h" 37 #include "chrome/browser/task_manager/task_manager_interface.h"
38 #include "chrome/common/chrome_constants.h"
39 #include "chrome/common/features.h" 38 #include "chrome/common/features.h"
40 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
41 #include "components/content_settings/core/browser/cookie_settings.h" 40 #include "components/content_settings/core/browser/cookie_settings.h"
42 #include "components/data_usage/core/data_use_aggregator.h" 41 #include "components/data_usage/core/data_use_aggregator.h"
43 #include "components/domain_reliability/monitor.h" 42 #include "components/domain_reliability/monitor.h"
44 #include "components/policy/core/browser/url_blacklist_manager.h" 43 #include "components/policy/core/browser/url_blacklist_manager.h"
45 #include "components/prefs/pref_member.h" 44 #include "components/prefs/pref_member.h"
46 #include "components/prefs/pref_service.h" 45 #include "components/prefs/pref_service.h"
47 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/render_frame_host.h" 47 #include "content/public/browser/render_frame_host.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 return true; 507 return true;
509 } 508 }
510 } 509 }
511 #elif defined(OS_ANDROID) 510 #elif defined(OS_ANDROID)
512 // Access to files in external storage is allowed. 511 // Access to files in external storage is allowed.
513 base::FilePath external_storage_path; 512 base::FilePath external_storage_path;
514 PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path); 513 PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path);
515 if (external_storage_path.IsParent(path)) 514 if (external_storage_path.IsParent(path))
516 return true; 515 return true;
517 516
518 // Allow to load offline pages, which are stored in the $PROFILE_PATH/Offline
519 // Pages/archives.
520 if (!profile_path_.empty()) {
521 const base::FilePath offline_page_archives =
522 profile_path_.Append(chrome::kOfflinePageArchivesDirname);
523 if (offline_page_archives.IsParent(path))
524 return true;
525 }
526
527 // Whitelist of other allowed directories. 517 // Whitelist of other allowed directories.
528 static const char* const kLocalAccessWhiteList[] = { 518 static const char* const kLocalAccessWhiteList[] = {
529 "/sdcard", 519 "/sdcard",
530 "/mnt/sdcard", 520 "/mnt/sdcard",
531 }; 521 };
532 #endif 522 #endif
533 523
534 for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) { 524 for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) {
535 const base::FilePath white_listed_path(kLocalAccessWhiteList[i]); 525 const base::FilePath white_listed_path(kLocalAccessWhiteList[i]);
536 // base::FilePath::operator== should probably handle trailing separators. 526 // base::FilePath::operator== should probably handle trailing separators.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (!data_use_aggregator_) 576 if (!data_use_aggregator_)
587 return; 577 return;
588 578
589 if (is_data_usage_off_the_record_) { 579 if (is_data_usage_off_the_record_) {
590 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); 580 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes);
591 return; 581 return;
592 } 582 }
593 583
594 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); 584 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes);
595 } 585 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/offline_pages/offline_internals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698