| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_USER_STYLE_SHEET_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ |
| 6 #define CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ | 6 #define CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/files/file_path_watcher.h" | 10 #include "base/files/file_path_watcher.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 BrowserThread::DeleteOnUIThread>, | 24 BrowserThread::DeleteOnUIThread>, |
| 25 public NotificationObserver { | 25 public NotificationObserver { |
| 26 public: | 26 public: |
| 27 explicit UserStyleSheetWatcher(const FilePath& profile_path); | 27 explicit UserStyleSheetWatcher(const FilePath& profile_path); |
| 28 | 28 |
| 29 void Init(); | 29 void Init(); |
| 30 | 30 |
| 31 GURL user_style_sheet() const; | 31 GURL user_style_sheet() const; |
| 32 | 32 |
| 33 // NotificationObserver interface | 33 // NotificationObserver interface |
| 34 virtual void Observe(NotificationType type, | 34 virtual void Observe(int type, |
| 35 const NotificationSource& source, | 35 const NotificationSource& source, |
| 36 const NotificationDetails& details); | 36 const NotificationDetails& details); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 39 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 40 friend class DeleteTask<UserStyleSheetWatcher>; | 40 friend class DeleteTask<UserStyleSheetWatcher>; |
| 41 | 41 |
| 42 virtual ~UserStyleSheetWatcher(); | 42 virtual ~UserStyleSheetWatcher(); |
| 43 | 43 |
| 44 // The directory containing User StyleSheets/Custom.css. | 44 // The directory containing User StyleSheets/Custom.css. |
| 45 FilePath profile_path_; | 45 FilePath profile_path_; |
| 46 | 46 |
| 47 // The loader object. | 47 // The loader object. |
| 48 scoped_refptr<UserStyleSheetLoader> loader_; | 48 scoped_refptr<UserStyleSheetLoader> loader_; |
| 49 | 49 |
| 50 // Watches for changes to the css file so we can reload the style sheet. | 50 // Watches for changes to the css file so we can reload the style sheet. |
| 51 scoped_ptr<base::files::FilePathWatcher> file_watcher_; | 51 scoped_ptr<base::files::FilePathWatcher> file_watcher_; |
| 52 | 52 |
| 53 NotificationRegistrar registrar_; | 53 NotificationRegistrar registrar_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetWatcher); | 55 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetWatcher); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ | 58 #endif // CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ |
| OLD | NEW |