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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop_helpers.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
17 | 18 |
18 class Profile; | 19 class Profile; |
19 class UserStyleSheetLoader; | 20 class UserStyleSheetLoader; |
20 | 21 |
21 // Watches the user style sheet file and triggers reloads on the file thread | 22 // Watches the user style sheet file and triggers reloads on the file thread |
22 // whenever the file changes. | 23 // whenever the file changes. |
(...skipping 10 matching lines...) Expand all Loading... |
33 GURL user_style_sheet() const; | 34 GURL user_style_sheet() const; |
34 | 35 |
35 // content::NotificationObserver interface | 36 // content::NotificationObserver interface |
36 virtual void Observe(int type, | 37 virtual void Observe(int type, |
37 const content::NotificationSource& source, | 38 const content::NotificationSource& source, |
38 const content::NotificationDetails& details) OVERRIDE; | 39 const content::NotificationDetails& details) OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 friend struct content::BrowserThread::DeleteOnThread< | 42 friend struct content::BrowserThread::DeleteOnThread< |
42 content::BrowserThread::UI>; | 43 content::BrowserThread::UI>; |
43 friend class DeleteTask<UserStyleSheetWatcher>; | 44 friend class base::DeleteHelper<UserStyleSheetWatcher>; |
44 | 45 |
45 virtual ~UserStyleSheetWatcher(); | 46 virtual ~UserStyleSheetWatcher(); |
46 | 47 |
47 // The profile owning us. | 48 // The profile owning us. |
48 Profile* profile_; | 49 Profile* profile_; |
49 | 50 |
50 // The directory containing User StyleSheets/Custom.css. | 51 // The directory containing User StyleSheets/Custom.css. |
51 FilePath profile_path_; | 52 FilePath profile_path_; |
52 | 53 |
53 // The loader object. | 54 // The loader object. |
54 scoped_refptr<UserStyleSheetLoader> loader_; | 55 scoped_refptr<UserStyleSheetLoader> loader_; |
55 | 56 |
56 // Watches for changes to the css file so we can reload the style sheet. | 57 // Watches for changes to the css file so we can reload the style sheet. |
57 scoped_ptr<base::files::FilePathWatcher> file_watcher_; | 58 scoped_ptr<base::files::FilePathWatcher> file_watcher_; |
58 | 59 |
59 content::NotificationRegistrar registrar_; | 60 content::NotificationRegistrar registrar_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetWatcher); | 62 DISALLOW_COPY_AND_ASSIGN(UserStyleSheetWatcher); |
62 }; | 63 }; |
63 | 64 |
64 #endif // CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ | 65 #endif // CHROME_BROWSER_USER_STYLE_SHEET_WATCHER_H_ |
OLD | NEW |