OLD | NEW |
| (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 BLIMP_CLIENT_ANDROID_TOOLBAR_H_ | |
6 #define BLIMP_CLIENT_ANDROID_TOOLBAR_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/macros.h" | |
10 #include "blimp/client/session/navigation_feature.h" | |
11 | |
12 class GURL; | |
13 class SkBitmap; | |
14 | |
15 namespace blimp { | |
16 namespace client { | |
17 | |
18 // The native component of org.chromium.blimp.toolbar.Toolbar. This handles | |
19 // marshalling calls between Java and native. Specifically, this passes calls | |
20 // between Toolbar.java <=> NavigationFeature. | |
21 class Toolbar : public NavigationFeature::NavigationFeatureDelegate { | |
22 public: | |
23 static bool RegisterJni(JNIEnv* env); | |
24 | |
25 Toolbar(JNIEnv* env, | |
26 const base::android::JavaParamRef<jobject>& jobj, | |
27 NavigationFeature* navigation_feature); | |
28 | |
29 // Methods called from Java via JNI. | |
30 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj); | |
31 void OnUrlTextEntered(JNIEnv* env, | |
32 const base::android::JavaParamRef<jobject>& jobj, | |
33 const base::android::JavaParamRef<jstring>& text); | |
34 void OnReloadPressed(JNIEnv* env, | |
35 const base::android::JavaParamRef<jobject>& jobj); | |
36 void OnForwardPressed(JNIEnv* env, | |
37 const base::android::JavaParamRef<jobject>& jobj); | |
38 jboolean OnBackPressed(JNIEnv* env, | |
39 const base::android::JavaParamRef<jobject>& jobj); | |
40 | |
41 // NavigationFeatureDelegate implementation. | |
42 void OnUrlChanged(int tab_id, const GURL& url) override; | |
43 void OnFaviconChanged(int tab_id, const SkBitmap& favicon) override; | |
44 void OnTitleChanged(int tab_id, const std::string& title) override; | |
45 void OnLoadingChanged(int tab_id, bool loading) override; | |
46 | |
47 private: | |
48 virtual ~Toolbar(); | |
49 | |
50 // A bridge to the network layer which does the work of (de)serializing the | |
51 // outgoing and incoming navigation messages from the engine. Toolbar does not | |
52 // own this and it is expected to outlive this Toolbar instance. | |
53 NavigationFeature* navigation_feature_; | |
54 | |
55 // Reference to the Java object which owns this class. | |
56 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(Toolbar); | |
59 }; | |
60 | |
61 } // namespace client | |
62 } // namespace blimp | |
63 | |
64 #endif // BLIMP_CLIENT_ANDROID_TOOLBAR_H_ | |
OLD | NEW |