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

Side by Side Diff: chrome/browser/android/service_tab_creator.h

Issue 897673002: First step in enabling creating tabs without an Activity on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a-base-mounir
Patch Set: s/NavigationUtils/ServiceTabCreator/g Created 5 years, 10 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
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698