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"
20 // Owns a ToolbarModel and provides a way for Java to interact with it.
21 class ToolbarModelAndroid
: public ToolbarModelDelegate
{
23 explicit ToolbarModelAndroid(JNIEnv
* env
, jobject jdelegate
);
24 ~ToolbarModelAndroid() override
;
26 void Destroy(JNIEnv
* env
, jobject obj
);
27 base::android::ScopedJavaLocalRef
<jstring
> GetText(
30 base::android::ScopedJavaLocalRef
<jstring
> GetCorpusChipText(
33 jboolean
WouldReplaceURL(JNIEnv
* env
, jobject obj
);
36 content::WebContents
* GetActiveWebContents() const override
;
38 static bool RegisterToolbarModelAndroid(JNIEnv
* env
);
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_