Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: components/web_contents_delegate_android/color_chooser_android.cc

Issue 11823046: Move content/components/web_contents_delegate_android to components/web_contents_delegate_android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (win7_aura so slow!!) Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/components/web_contents_delegate_android/color_chooser_android .h" 5 #include "components/web_contents_delegate_android/color_chooser_android.h"
6 6
7 #include "content/public/browser/android/content_view_core.h" 7 #include "content/public/browser/android/content_view_core.h"
8 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
9 #include "jni/ColorChooserAndroid_jni.h" 9 #include "jni/ColorChooserAndroid_jni.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 ColorChooser* ColorChooser::Create(
14 int identifier, WebContents* tab, SkColor initial_color) {
15 return new components::ColorChooserAndroid(identifier, tab, initial_color);
16 }
17
18 } // namespace content
19
20 namespace components {
21
13 ColorChooserAndroid::ColorChooserAndroid(int identifier, 22 ColorChooserAndroid::ColorChooserAndroid(int identifier,
14 content::WebContents* tab, 23 content::WebContents* tab,
15 SkColor initial_color) 24 SkColor initial_color)
16 : ColorChooser::ColorChooser(identifier), 25 : ColorChooser::ColorChooser(identifier),
17 content::WebContentsObserver(tab) { 26 content::WebContentsObserver(tab) {
18 JNIEnv* env = AttachCurrentThread(); 27 JNIEnv* env = AttachCurrentThread();
19 ContentViewCore* content_view_core = tab->GetContentNativeView(); 28 content::ContentViewCore* content_view_core = tab->GetContentNativeView();
20 DCHECK(content_view_core); 29 DCHECK(content_view_core);
21 30
22 j_color_chooser_.Reset(Java_ColorChooserAndroid_createColorChooserAndroid( 31 j_color_chooser_.Reset(Java_ColorChooserAndroid_createColorChooserAndroid(
23 env, 32 env,
24 reinterpret_cast<intptr_t>(this), 33 reinterpret_cast<intptr_t>(this),
25 content_view_core->GetJavaObject().obj(), 34 content_view_core->GetJavaObject().obj(),
26 initial_color)); 35 initial_color));
27 } 36 }
28 37
29 ColorChooserAndroid::~ColorChooserAndroid() { 38 ColorChooserAndroid::~ColorChooserAndroid() {
(...skipping 10 matching lines...) Expand all
40 // Not implemented since the color is set on the java side only, in theory 49 // Not implemented since the color is set on the java side only, in theory
41 // it can be set from JS which would override the user selection but 50 // it can be set from JS which would override the user selection but
42 // we don't support that for now. 51 // we don't support that for now.
43 } 52 }
44 53
45 void ColorChooserAndroid::OnColorChosen(JNIEnv* env, jobject obj, jint color) { 54 void ColorChooserAndroid::OnColorChosen(JNIEnv* env, jobject obj, jint color) {
46 web_contents()->DidChooseColorInColorChooser(identifier(), color); 55 web_contents()->DidChooseColorInColorChooser(identifier(), color);
47 web_contents()->DidEndColorChooser(identifier()); 56 web_contents()->DidEndColorChooser(identifier());
48 } 57 }
49 58
50 content::ColorChooser* content::ColorChooser::Create(
51 int identifier, content::WebContents* tab, SkColor initial_color) {
52 return new ColorChooserAndroid(identifier, tab, initial_color);
53 }
54
55 // ---------------------------------------------------------------------------- 59 // ----------------------------------------------------------------------------
56 // Native JNI methods 60 // Native JNI methods
57 // ---------------------------------------------------------------------------- 61 // ----------------------------------------------------------------------------
58 bool RegisterColorChooserAndroid(JNIEnv* env) { 62 bool RegisterColorChooserAndroid(JNIEnv* env) {
59 return RegisterNativesImpl(env); 63 return RegisterNativesImpl(env);
60 } 64 }
61 65
62 } // namespace content 66 } // namespace components
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698