| 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 CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ | 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" | 13 #include "components/keyed_service/core/keyed_service.h" |
| 12 | 14 |
| 15 namespace base { |
| 16 class FilePath; |
| 17 } |
| 18 |
| 13 namespace previews { | 19 namespace previews { |
| 20 class PreviewsIOData; |
| 14 class PreviewsUIService; | 21 class PreviewsUIService; |
| 15 } | 22 } |
| 16 | 23 |
| 17 // Keyed service that owns a previews::PreviewsUIService. PreviewsService lives | 24 // Keyed service that owns a previews::PreviewsUIService. PreviewsService lives |
| 18 // on the UI thread. | 25 // on the UI thread. |
| 19 class PreviewsService : public KeyedService { | 26 class PreviewsService : public KeyedService { |
| 20 public: | 27 public: |
| 21 PreviewsService(); | 28 PreviewsService(); |
| 22 ~PreviewsService() override; | 29 ~PreviewsService() override; |
| 23 | 30 |
| 24 // The previews UI thread service. | 31 // Initializes the UI Service. |previews_io_data| is the main previews IO |
| 25 void set_previews_ui_service( | 32 // object, and cannot be null. |io_task_runner| is the IO thread task runner. |
| 26 std::unique_ptr<previews::PreviewsUIService> previews_ui_service); | 33 // |profile_path| is the path to user data on disc. |
| 34 void Initialize( |
| 35 previews::PreviewsIOData* previews_io_data, |
| 36 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 37 const base::FilePath& profile_path); |
| 38 |
| 27 previews::PreviewsUIService* previews_ui_service() { | 39 previews::PreviewsUIService* previews_ui_service() { |
| 28 return previews_ui_service_.get(); | 40 return previews_ui_service_.get(); |
| 29 } | 41 } |
| 30 | 42 |
| 31 private: | 43 private: |
| 32 // The previews UI thread service. | 44 // The previews UI thread service. |
| 33 std::unique_ptr<previews::PreviewsUIService> previews_ui_service_; | 45 std::unique_ptr<previews::PreviewsUIService> previews_ui_service_; |
| 34 | 46 |
| 35 DISALLOW_COPY_AND_ASSIGN(PreviewsService); | 47 DISALLOW_COPY_AND_ASSIGN(PreviewsService); |
| 36 }; | 48 }; |
| 37 | 49 |
| 38 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ | 50 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_H_ |
| OLD | NEW |