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> | |
6 | |
7 #include "base/android/jni_android.h" | |
8 #include "base/android/jni_string.h" | |
5 #include "base/logging.h" | 9 #include "base/logging.h" |
6 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
11 #include "jni/PlatformUtil_jni.h" | |
7 #include "ui/android/view_android.h" | 12 #include "ui/android/view_android.h" |
13 #include "url/gurl.h" | |
8 | 14 |
9 namespace platform_util { | 15 namespace platform_util { |
10 | 16 |
11 // TODO: crbug/115682 to track implementation of the following methods. | 17 // TODO: crbug/115682 to track implementation of the following methods. |
12 | 18 |
13 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { | 19 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
14 NOTIMPLEMENTED(); | 20 NOTIMPLEMENTED(); |
15 } | 21 } |
16 | 22 |
17 void OpenItem(Profile* profile, | 23 void OpenItem(Profile* profile, |
18 const base::FilePath& full_path, | 24 const base::FilePath& full_path, |
19 OpenItemType item_type, | 25 OpenItemType item_type, |
20 const OpenOperationCallback& callback) { | 26 const OpenOperationCallback& callback) { |
21 NOTIMPLEMENTED(); | 27 NOTIMPLEMENTED(); |
22 } | 28 } |
23 | 29 |
24 void OpenExternal(Profile* profile, const GURL& url) { | 30 void OpenExternal(Profile* profile, const GURL& url) { |
25 NOTIMPLEMENTED(); | 31 JNIEnv* env = base::android::AttachCurrentThread(); |
32 ScopedJavaLocalRef<jstring> j_url = | |
33 base::android::ConvertUTF8ToJavaString(env, url.spec()); | |
34 Java_PlatformUtil_launchExternalProtocol(env, j_url.obj()); | |
26 } | 35 } |
27 | 36 |
28 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 37 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
29 NOTIMPLEMENTED(); | 38 NOTIMPLEMENTED(); |
30 return view->GetWindowAndroid(); | 39 return view->GetWindowAndroid(); |
31 } | 40 } |
32 | 41 |
33 gfx::NativeView GetParent(gfx::NativeView view) { | 42 gfx::NativeView GetParent(gfx::NativeView view) { |
34 NOTIMPLEMENTED(); | 43 NOTIMPLEMENTED(); |
35 return view; | 44 return view; |
36 } | 45 } |
37 | 46 |
38 bool IsWindowActive(gfx::NativeWindow window) { | 47 bool IsWindowActive(gfx::NativeWindow window) { |
39 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
40 return false; | 49 return false; |
41 } | 50 } |
42 | 51 |
43 void ActivateWindow(gfx::NativeWindow window) { | 52 void ActivateWindow(gfx::NativeWindow window) { |
44 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
45 } | 54 } |
46 | 55 |
47 bool IsVisible(gfx::NativeView view) { | 56 bool IsVisible(gfx::NativeView view) { |
48 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
49 return true; | 58 return true; |
50 } | 59 } |
51 | 60 |
61 bool RegisterPlatformUtil(JNIEnv* env) { | |
62 return RegisterNativesImpl(env); | |
63 } | |
64 | |
sky
2015/09/08 15:09:14
nit: only one newline here.
| |
65 | |
52 } // namespace platform_util | 66 } // namespace platform_util |
OLD | NEW |