OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
Miguel Garcia
2015/02/03 16:58:40
There is already an intentHelper c++/java that doe
Peter Beverloo
2015/02/03 17:24:54
Nah, because this class will need to keep request
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ANDROID_SERVICE_TAB_CREATOR_H_ | |
6 #define CHROME_BROWSER_ANDROID_SERVICE_TAB_CREATOR_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/callback_forward.h" | |
10 #include "base/memory/singleton.h" | |
11 | |
12 namespace content { | |
13 class BrowserContext; | |
14 struct OpenURLParams; | |
15 class WebContents; | |
16 } | |
17 | |
Miguel Garcia
2015/02/03 16:58:40
namespace it?
Peter Beverloo
2015/02/03 17:24:54
Done. "namespace chrome {}" eeuw :-(
| |
18 // Class for creating new tabs on Android from a background service, where there | |
19 // may not necessarily be an Activity or a tab model at all. The creator is | |
20 // able to report back to the user when the tab has been created. | |
Miguel Garcia
2015/02/03 16:58:40
same thing, we are not quite able to report back y
Peter Beverloo
2015/02/03 17:24:54
Done.
| |
21 class ServiceTabCreator { | |
22 public: | |
23 // Returns the singleton instance of the service tab creator. | |
24 static ServiceTabCreator* GetInstance(); | |
25 | |
26 // Creates a new tab when we're in an Android Service rather than an Activity. | |
27 // |callback| will be invoked with the resulting content::WebContents* when | |
28 // the tab is avialable. This method must only be called from the UI thread. | |
29 void CreateTab(content::BrowserContext* browser_context, | |
30 const content::OpenURLParams& params, | |
31 base::Callback<void(content::WebContents*)> callback); | |
32 | |
33 static bool RegisterServiceTabCreator(JNIEnv* env); | |
34 | |
35 private: | |
36 friend struct DefaultSingletonTraits<ServiceTabCreator>; | |
37 | |
38 ServiceTabCreator(); | |
39 ~ServiceTabCreator(); | |
40 | |
41 base::android::ScopedJavaGlobalRef<jobject> java_object_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(ServiceTabCreator); | |
44 }; | |
45 | |
46 #endif // CHROME_BROWSER_ANDROID_SERVICE_TAB_CREATOR_H_ | |
OLD | NEW |