| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ | 5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ |
| 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ | 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // after initialization. | 35 // after initialization. |
| 36 class PreviewsIOData : public PreviewsDecider { | 36 class PreviewsIOData : public PreviewsDecider { |
| 37 public: | 37 public: |
| 38 PreviewsIOData( | 38 PreviewsIOData( |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 39 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| 40 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 40 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 41 ~PreviewsIOData() override; | 41 ~PreviewsIOData() override; |
| 42 | 42 |
| 43 // Stores |previews_ui_service| as |previews_ui_service_| and posts a task to | 43 // Stores |previews_ui_service| as |previews_ui_service_| and posts a task to |
| 44 // InitializeOnIOThread on the IO thread. | 44 // InitializeOnIOThread on the IO thread. |
| 45 void Initialize(base::WeakPtr<PreviewsUIService> previews_ui_service, | 45 virtual void Initialize( |
| 46 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store, | 46 base::WeakPtr<PreviewsUIService> previews_ui_service, |
| 47 const PreviewsIsEnabledCallback& is_enabled_callback); | 47 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store, |
| 48 const PreviewsIsEnabledCallback& is_enabled_callback); |
| 48 | 49 |
| 49 // Adds a navigation to |url| to the black list with result |opt_out|. | 50 // Adds a navigation to |url| to the black list with result |opt_out|. |
| 50 void AddPreviewNavigation(const GURL& url, bool opt_out, PreviewsType type); | 51 void AddPreviewNavigation(const GURL& url, bool opt_out, PreviewsType type); |
| 51 | 52 |
| 52 // Clears the history of the black list between |begin_time| and |end_time|, | 53 // Clears the history of the black list between |begin_time| and |end_time|, |
| 53 // both inclusive. | 54 // both inclusive. |
| 54 void ClearBlackList(base::Time begin_time, base::Time end_time); | 55 void ClearBlackList(base::Time begin_time, base::Time end_time); |
| 55 | 56 |
| 56 // The previews black list that decides whether a navigation can use previews. | 57 // The previews black list that decides whether a navigation can use previews. |
| 57 PreviewsBlackList* black_list() const { return previews_black_list_.get(); } | 58 PreviewsBlackList* black_list() const { return previews_black_list_.get(); } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 83 PreviewsIsEnabledCallback is_enabled_callback_; | 84 PreviewsIsEnabledCallback is_enabled_callback_; |
| 84 | 85 |
| 85 base::WeakPtrFactory<PreviewsIOData> weak_factory_; | 86 base::WeakPtrFactory<PreviewsIOData> weak_factory_; |
| 86 | 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(PreviewsIOData); | 88 DISALLOW_COPY_AND_ASSIGN(PreviewsIOData); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace previews | 91 } // namespace previews |
| 91 | 92 |
| 92 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ | 93 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_IO_DATA_H_ |
| OLD | NEW |