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

Side by Side Diff: components/translate/content/browser/content_translate_driver.h

Issue 133273029: Move LanguageState to the translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update BUILD.gn Created 6 years, 11 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 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.
4
5 #ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_
6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_
7
8 #include "components/translate/core/browser/translate_driver.h"
9
10 #include "components/translate/core/browser/language_state.h"
11
12 namespace content {
13 struct LoadCommittedDetails;
14 class NavigationController;
15 class WebContents;
16 }
17
18 // Content implementation of TranslateDriver.
19 class ContentTranslateDriver : public TranslateDriver {
20 public:
21
22 // The observer for the ContentTranslateDriver.
23 class Observer {
24 public:
25 // Handles when the value of IsPageTranslated is changed.
26 virtual void OnIsPageTranslatedChanged(content::WebContents* source) = 0;
27
28 // Handles when the value of translate_enabled is changed.
29 virtual void OnTranslateEnabledChanged(content::WebContents* source) = 0;
30
31 protected:
32 virtual ~Observer() {}
33 };
34
35 ContentTranslateDriver(content::NavigationController* nav_controller);
36 virtual ~ContentTranslateDriver();
37
38 // Gets the language state.
39 LanguageState& language_state() { return language_state_; }
40
41 // Sets the LanguageStateObserver. Calling this method is optional.
MAD 2014/01/20 21:47:36 LanguageStateObserver -> Observer
42 void set_observer(Observer* observer) { observer_ = observer; }
43
44 // Must be called on navigations.
45 void DidNavigate(const content::LoadCommittedDetails& details);
46
47 private:
48 // TranslateDriver methods
49 virtual void OnIsPageTranslatedChanged() OVERRIDE;
50 virtual void OnTranslateEnabledChanged() OVERRIDE;
51 virtual bool IsLinkNavigation() OVERRIDE;
52
53 // The navigation controller of the tab we are associated with.
54 content::NavigationController* navigation_controller_;
55
56 LanguageState language_state_;
57 Observer* observer_;
58
59 DISALLOW_COPY_AND_ASSIGN(ContentTranslateDriver);
60 };
61
62 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_
OLDNEW
« no previous file with comments | « components/translate/content/browser/DEPS ('k') | components/translate/content/browser/content_translate_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698