OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <jni.h> | 5 #include <jni.h> |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
11 #include "url/gurl.h" | |
12 | |
13 #if defined(ANDROID_JAVA_UI) | |
11 #include "jni/PlatformUtil_jni.h" | 14 #include "jni/PlatformUtil_jni.h" |
12 #include "ui/android/view_android.h" | 15 #include "ui/android/view_android.h" |
13 #include "url/gurl.h" | 16 #endif |
14 | 17 |
15 namespace platform_util { | 18 namespace platform_util { |
Ted C
2015/11/30 19:39:05
To me, it looks like you shouldn't be using this c
no sievers
2015/11/30 23:56:34
Makes sense. Changes reverted.
| |
16 | 19 |
17 // TODO: crbug/115682 to track implementation of the following methods. | 20 // TODO: crbug/115682 to track implementation of the following methods. |
18 | 21 |
19 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { | 22 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
20 NOTIMPLEMENTED(); | 23 NOTIMPLEMENTED(); |
21 } | 24 } |
22 | 25 |
23 void OpenItem(Profile* profile, | 26 void OpenItem(Profile* profile, |
24 const base::FilePath& full_path, | 27 const base::FilePath& full_path, |
25 OpenItemType item_type, | 28 OpenItemType item_type, |
26 const OpenOperationCallback& callback) { | 29 const OpenOperationCallback& callback) { |
27 NOTIMPLEMENTED(); | 30 NOTIMPLEMENTED(); |
28 } | 31 } |
29 | 32 |
30 void OpenExternal(Profile* profile, const GURL& url) { | 33 void OpenExternal(Profile* profile, const GURL& url) { |
34 #if defined(ANDROID_JAVA_UI) | |
31 JNIEnv* env = base::android::AttachCurrentThread(); | 35 JNIEnv* env = base::android::AttachCurrentThread(); |
32 ScopedJavaLocalRef<jstring> j_url = | 36 ScopedJavaLocalRef<jstring> j_url = |
33 base::android::ConvertUTF8ToJavaString(env, url.spec()); | 37 base::android::ConvertUTF8ToJavaString(env, url.spec()); |
34 Java_PlatformUtil_launchExternalProtocol(env, j_url.obj()); | 38 Java_PlatformUtil_launchExternalProtocol(env, j_url.obj()); |
39 #endif | |
35 } | 40 } |
36 | 41 |
37 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 42 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
43 #if defined(ANDROID_JAVA_UI) | |
38 NOTIMPLEMENTED(); | 44 NOTIMPLEMENTED(); |
39 return view->GetWindowAndroid(); | 45 return view->GetWindowAndroid(); |
46 #else | |
47 NOTIMPLEMENTED(); | |
48 return nullptr; | |
49 #endif | |
40 } | 50 } |
41 | 51 |
42 gfx::NativeView GetParent(gfx::NativeView view) { | 52 gfx::NativeView GetParent(gfx::NativeView view) { |
43 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
44 return view; | 54 return view; |
45 } | 55 } |
46 | 56 |
47 bool IsWindowActive(gfx::NativeWindow window) { | 57 bool IsWindowActive(gfx::NativeWindow window) { |
48 NOTIMPLEMENTED(); | 58 NOTIMPLEMENTED(); |
49 return false; | 59 return false; |
50 } | 60 } |
51 | 61 |
52 void ActivateWindow(gfx::NativeWindow window) { | 62 void ActivateWindow(gfx::NativeWindow window) { |
53 NOTIMPLEMENTED(); | 63 NOTIMPLEMENTED(); |
54 } | 64 } |
55 | 65 |
56 bool IsVisible(gfx::NativeView view) { | 66 bool IsVisible(gfx::NativeView view) { |
57 NOTIMPLEMENTED(); | 67 NOTIMPLEMENTED(); |
58 return true; | 68 return true; |
59 } | 69 } |
60 | 70 |
71 #if defined(ANDROID_JAVA_UI) | |
61 bool RegisterPlatformUtil(JNIEnv* env) { | 72 bool RegisterPlatformUtil(JNIEnv* env) { |
62 return RegisterNativesImpl(env); | 73 return RegisterNativesImpl(env); |
63 } | 74 } |
75 #endif | |
64 | 76 |
65 } // namespace platform_util | 77 } // namespace platform_util |
OLD | NEW |