OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/offline_pages/offline_page_utils.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" | 9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" |
10 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 10 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // static | 115 // static |
116 bool OfflinePageUtils::HasOfflinePageForOnlineURL( | 116 bool OfflinePageUtils::HasOfflinePageForOnlineURL( |
117 content::BrowserContext* browser_context, | 117 content::BrowserContext* browser_context, |
118 const GURL& online_url) { | 118 const GURL& online_url) { |
119 const offline_pages::OfflinePageItem* offline_page = | 119 const offline_pages::OfflinePageItem* offline_page = |
120 GetOfflinePageForOnlineURL(browser_context, online_url); | 120 GetOfflinePageForOnlineURL(browser_context, online_url); |
121 return offline_page && !offline_page->file_path.empty(); | 121 return offline_page && !offline_page->file_path.empty(); |
122 } | 122 } |
123 | 123 |
124 // static | 124 // static |
125 const bool OfflinePageUtils::HasOfflinePages( | 125 bool OfflinePageUtils::HasOfflinePages( |
126 content::BrowserContext* browser_context) { | 126 content::BrowserContext* browser_context) { |
127 DCHECK(browser_context); | 127 DCHECK(browser_context); |
128 | 128 |
129 if (!offline_pages::IsOfflinePagesEnabled()) | 129 if (!offline_pages::IsOfflinePagesEnabled()) |
130 return false; | 130 return false; |
131 | 131 |
132 offline_pages::OfflinePageModel* offline_page_model = | 132 offline_pages::OfflinePageModel* offline_page_model = |
133 offline_pages::OfflinePageModelFactory::GetForBrowserContext( | 133 offline_pages::OfflinePageModelFactory::GetForBrowserContext( |
134 browser_context); | 134 browser_context); |
135 return offline_page_model->HasOfflinePages(); | 135 return offline_page_model->HasOfflinePages(); |
136 } | 136 } |
137 | 137 |
138 } // namespace offline_pages | 138 } // namespace offline_pages |
OLD | NEW |