Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.h

Issue 1274753006: Modify languageSettingsPrivate IDL and flesh out stub implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_LANGUAGE_SETTINGS_PRIVATE_LANGUAGE_SETTING S_PRIVATE_DELEGATE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_LANGUAGE_SETTINGS_PRIVATE_LANGUAGE_SETTING S_PRIVATE_DELEGATE_H_
7
8 #include "chrome/common/extensions/api/language_settings_private.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 #include "extensions/browser/event_router.h"
11
12 namespace content {
13 class BrowserContext;
14 }
15
16 namespace extensions {
17
18 // Observes language settings and routes changes as events to listeners of the
19 // languageSettingsPrivate API.
20 class LanguageSettingsPrivateDelegate
21 : public KeyedService,
22 public EventRouter::Observer {
23 public:
24 static LanguageSettingsPrivateDelegate* Create(
25 content::BrowserContext* browser_context);
26 ~LanguageSettingsPrivateDelegate() override;
27
28 protected:
29 explicit LanguageSettingsPrivateDelegate(content::BrowserContext* context);
30
31 // KeyedService implementation.
32 void Shutdown() override;
33
34 // EventRouter::Observer implementation.
35 void OnListenerAdded(const EventListenerInfo& details) override;
36 void OnListenerRemoved(const EventListenerInfo& details) override;
37
38 private:
39 // If there are any JavaScript listeners registered for spellcheck events,
40 // ensures we are registered for change notifications. Otherwise, unregisters
41 // any observers.
42 void StartOrStopListeningForSpellcheckChanges();
43
44 content::BrowserContext* context_;
45
46 // True if there are observers listening for spellcheck events.
47 bool listening_spellcheck_;
48
49 DISALLOW_COPY_AND_ASSIGN(LanguageSettingsPrivateDelegate);
50 };
51
52 } // namespace extensions
53
54 #endif // CHROME_BROWSER_EXTENSIONS_API_LANGUAGE_SETTINGS_PRIVATE_LANGUAGE_SETT INGS_PRIVATE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698