1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_ANDROID_LOGO_SERVICE_H_
6 #define CHROME_BROWSER_ANDROID_LOGO_SERVICE_H_
8 #include "base/memory/singleton.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
10 #include "components/keyed_service/core/keyed_service.h"
11 #include "components/search_provider_logos/logo_tracker.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
16 // Provides the logo for a profile's default search provider.
19 // LogoService* logo_service = LogoServiceFactory::GetForProfile(profile);
20 // logo_service->GetLogo(...);
22 class LogoService
: public KeyedService
{
24 explicit LogoService(Profile
* profile
);
25 ~LogoService() override
;
27 // Gets the logo for the default search provider and notifies |observer|
29 void GetLogo(search_provider_logos::LogoObserver
* observer
);
33 scoped_ptr
<search_provider_logos::LogoTracker
> logo_tracker_
;
35 DISALLOW_COPY_AND_ASSIGN(LogoService
);
38 // Singleton that owns all LogoServices and associates them with Profiles.
39 class LogoServiceFactory
: public BrowserContextKeyedServiceFactory
{
41 static LogoService
* GetForProfile(Profile
* profile
);
43 static LogoServiceFactory
* GetInstance();
46 friend struct DefaultSingletonTraits
<LogoServiceFactory
>;
49 ~LogoServiceFactory() override
;
51 // BrowserContextKeyedServiceFactory:
52 KeyedService
* BuildServiceInstanceFor(
53 content::BrowserContext
* context
) const override
;
56 #endif // CHROME_BROWSER_ANDROID_LOGO_SERVICE_H_