Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / android / toolbar / toolbar_model_android.h
blobf5f9c7a1b72aceec8152d8558926112f828099e0
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_UI_ANDROID_TOOLBAR_TOOLBAR_MODEL_ANDROID_H_
6 #define CHROME_BROWSER_UI_ANDROID_TOOLBAR_TOOLBAR_MODEL_ANDROID_H_
8 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h"
10 #include "base/android/scoped_java_ref.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h"
14 #include "components/toolbar/toolbar_model.h"
16 namespace content {
17 class WebContents;
18 } // content
20 // Owns a ToolbarModel and provides a way for Java to interact with it.
21 class ToolbarModelAndroid : public ToolbarModelDelegate {
22 public:
23 explicit ToolbarModelAndroid(JNIEnv* env, jobject jdelegate);
24 ~ToolbarModelAndroid() override;
26 void Destroy(JNIEnv* env, jobject obj);
27 base::android::ScopedJavaLocalRef<jstring> GetText(
28 JNIEnv* env,
29 jobject obj);
30 base::android::ScopedJavaLocalRef<jstring> GetCorpusChipText(
31 JNIEnv* env,
32 jobject obj);
33 jboolean WouldReplaceURL(JNIEnv* env, jobject obj);
35 // ToolbarDelegate:
36 content::WebContents* GetActiveWebContents() const override;
38 static bool RegisterToolbarModelAndroid(JNIEnv* env);
40 private:
41 scoped_ptr<ToolbarModel> toolbar_model_;
42 JavaObjectWeakGlobalRef weak_java_delegate_;
44 DISALLOW_IMPLICIT_CONSTRUCTORS(ToolbarModelAndroid);
47 #endif // CHROME_BROWSER_UI_ANDROID_TOOLBAR_TOOLBAR_MODEL_ANDROID_H_