diff options
author | jianli <jianli@chromium.org> | 2016-03-07 13:04:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-07 21:06:42 +0000 |
commit | 364f4ef0f205967019fbb0b55f0bbb96ab76ad7d (patch) | |
tree | b8d36a140174ff95f1a235dc670defcf44e178ea /components/offline_pages | |
parent | b267bd1d2a0444b8b3b9285a0018194a1b3e72d7 (diff) | |
download | chromium_src-364f4ef0f205967019fbb0b55f0bbb96ab76ad7d.zip chromium_src-364f4ef0f205967019fbb0b55f0bbb96ab76ad7d.tar.gz chromium_src-364f4ef0f205967019fbb0b55f0bbb96ab76ad7d.tar.bz2 |
Enable offline pages feature on trunk by default
BUG=592718
Review URL: https://codereview.chromium.org/1764843003
Cr-Commit-Position: refs/heads/master@{#379639}
Diffstat (limited to 'components/offline_pages')
-rw-r--r-- | components/offline_pages/BUILD.gn | 1 | ||||
-rw-r--r-- | components/offline_pages/DEPS | 1 | ||||
-rw-r--r-- | components/offline_pages/offline_page_feature.cc | 6 | ||||
-rw-r--r-- | components/offline_pages/offline_page_model.cc | 9 |
4 files changed, 15 insertions, 2 deletions
diff --git a/components/offline_pages/BUILD.gn b/components/offline_pages/BUILD.gn index 88dbd1e..cdbdb7b 100644 --- a/components/offline_pages/BUILD.gn +++ b/components/offline_pages/BUILD.gn @@ -61,6 +61,7 @@ source_set("switches") { deps = [ "//base", + "//components/version_info", ] } diff --git a/components/offline_pages/DEPS b/components/offline_pages/DEPS index 9f96ba9..2a2c644 100644 --- a/components/offline_pages/DEPS +++ b/components/offline_pages/DEPS @@ -2,6 +2,7 @@ include_rules = [ "+components/bookmarks", "+components/keyed_service", "+components/leveldb_proto", + "+components/version_info", "+net", "+third_party/leveldatabase", ] diff --git a/components/offline_pages/offline_page_feature.cc b/components/offline_pages/offline_page_feature.cc index beee145..ed390b8 100644 --- a/components/offline_pages/offline_page_feature.cc +++ b/components/offline_pages/offline_page_feature.cc @@ -11,6 +11,7 @@ #include "base/strings/string_util.h" #include "build/build_config.h" #include "components/offline_pages/offline_page_switches.h" +#include "components/version_info/version_info.h" #if defined(OS_ANDROID) @@ -62,7 +63,10 @@ FeatureMode GetOfflinePageFeatureMode() { base::CompareCase::SENSITIVE)) { return FeatureMode::ENABLED_AS_SAVED_PAGES; } - return FeatureMode::DISABLED; + + // Enabled by default on trunk. + return version_info::IsOfficialBuild() ? FeatureMode::DISABLED + : FeatureMode::ENABLED_AS_BOOKMARKS; } bool IsOfflinePagesEnabled() { diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc index 8dd7491..50698ff 100644 --- a/components/offline_pages/offline_page_model.cc +++ b/components/offline_pages/offline_page_model.cc @@ -286,7 +286,14 @@ void OfflinePageModel::ClearAll(const base::Closure& callback) { } bool OfflinePageModel::HasOfflinePages() const { - DCHECK(is_loaded_); + // Since offline pages feature is enabled by default, + // NetErrorTabHelper::SetHasOfflinePages might call this before the model is + // fully loaded. To address this, we need to switch to asynchonous model + // (crbug.com/589526). But for now, we just bail out to work around the test + // issue. + if (!is_loaded_) + return false; + // Check that at least one page is not marked for deletion. Because we have // pages marked for deletion, we cannot simply invert result of |empty()|. for (const auto& id_page_pair : offline_pages_) { |