OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 scoped_refptr<TokenWebData> token_web_data_; | 46 scoped_refptr<TokenWebData> token_web_data_; |
47 scoped_refptr<WebDataService> web_data_; | 47 scoped_refptr<WebDataService> web_data_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); | 49 DISALLOW_COPY_AND_ASSIGN(WebDataServiceWrapper); |
50 }; | 50 }; |
51 | 51 |
52 // Singleton that owns all WebDataServiceWrappers and associates them with | 52 // Singleton that owns all WebDataServiceWrappers and associates them with |
53 // Profiles. | 53 // Profiles. |
54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { | 54 class WebDataServiceFactory : public BrowserContextKeyedServiceFactory { |
55 public: | 55 public: |
56 // Returns the |WebDataServiceWrapper| associated with the |profile|. | 56 // Returns the |WebDataServiceWrapper| associated with the |profile|. |
Peter Kasting
2013/11/19 19:14:15
Nit: While here: remove pipes around type name (th
blundell
2013/12/02 16:11:00
Done.
| |
57 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS | 57 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS |
58 // (see its definition). | 58 // (see its definition). |
Peter Kasting
2013/11/19 19:14:15
Nit: While here: Remove this last sentence enumera
blundell
2013/12/02 16:11:00
Done.
| |
59 static WebDataServiceWrapper* GetForProfile( | 59 static WebDataServiceWrapper* GetForProfile( |
60 Profile* profile, Profile::ServiceAccessType access_type); | 60 Profile* profile, Profile::ServiceAccessType access_type); |
Peter Kasting
2013/11/19 19:14:15
Nit: While here: This is legal, but I tend to pref
blundell
2013/12/02 16:11:00
Done.
| |
61 | 61 |
62 static WebDataServiceWrapper* GetForProfileIfExists( | 62 static WebDataServiceWrapper* GetForProfileIfExists( |
63 Profile* profile, Profile::ServiceAccessType access_type); | 63 Profile* profile, Profile::ServiceAccessType access_type); |
64 | 64 |
65 // Returns the |AutofillWebDataService| associated with the |profile| (as | |
66 // |AutofillWebDataService| is shared with iOS, it cannot know directly about | |
67 // BrowserContext/Profile and thus cannot define this getter itself). | |
Peter Kasting
2013/11/19 19:14:15
Nit: Just:
// Returns the AutofillWebDataServic
blundell
2013/12/02 16:11:00
Done.
| |
68 // |access_type| is either EXPLICIT_ACCESS or IMPLICIT_ACCESS | |
69 // (see its definition). | |
70 static scoped_refptr<autofill::AutofillWebDataService> | |
Peter Kasting
2013/11/19 19:14:15
I thought our current recommendation on scoped_ref
blundell
2013/12/02 16:11:00
Yes, I filed crbug.com/321059. I'd rather keep tho
| |
71 GetAutofillWebDataForProfile(Profile* profile, | |
72 Profile::ServiceAccessType access_type); | |
73 | |
65 static WebDataServiceFactory* GetInstance(); | 74 static WebDataServiceFactory* GetInstance(); |
66 | 75 |
67 private: | 76 private: |
68 friend struct DefaultSingletonTraits<WebDataServiceFactory>; | 77 friend struct DefaultSingletonTraits<WebDataServiceFactory>; |
69 | 78 |
70 WebDataServiceFactory(); | 79 WebDataServiceFactory(); |
71 virtual ~WebDataServiceFactory(); | 80 virtual ~WebDataServiceFactory(); |
72 | 81 |
73 // |BrowserContextKeyedBaseFactory| methods: | 82 // |BrowserContextKeyedBaseFactory| methods: |
74 virtual content::BrowserContext* GetBrowserContextToUse( | 83 virtual content::BrowserContext* GetBrowserContextToUse( |
75 content::BrowserContext* context) const OVERRIDE; | 84 content::BrowserContext* context) const OVERRIDE; |
76 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 85 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
77 content::BrowserContext* profile) const OVERRIDE; | 86 content::BrowserContext* profile) const OVERRIDE; |
78 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | 87 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; |
79 | 88 |
80 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); | 89 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFactory); |
81 }; | 90 }; |
82 | 91 |
83 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ | 92 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_FACTORY_H__ |
OLD | NEW |