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

Side by Side Diff: blimp/client/public/blimp_client_context.h

Issue 2292723003: Move remaining Blimp feature code to core. (Closed)
Patch Set: Fix build break Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ 5 #ifndef BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_
6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ 6 #define BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "blimp/client/public/blimp_client_context_delegate.h" 13 #include "blimp/client/public/blimp_client_context_delegate.h"
14 #include "blimp/client/public/contents/blimp_contents.h" 14 #include "blimp/client/public/contents/blimp_contents.h"
15 #include "components/keyed_service/core/keyed_service.h" 15 #include "components/keyed_service/core/keyed_service.h"
16 16
17 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
18 #include "base/android/jni_android.h" 18 #include "base/android/jni_android.h"
19 #endif // defined(OS_ANDROID) 19 #endif // defined(OS_ANDROID)
20 20
21 namespace base { 21 namespace base {
22 class SupportsUserData; 22 class SupportsUserData;
23 } 23 }
24 24
25 namespace blimp { 25 namespace blimp {
26 namespace client { 26 namespace client {
27 27
28 class CompositorDependencies;
29
28 // BlimpClientContext is the core class for the Blimp client. It provides hooks 30 // BlimpClientContext is the core class for the Blimp client. It provides hooks
29 // for creating BlimpContents and other features that are per 31 // for creating BlimpContents and other features that are per
30 // BrowserContext/Profile. 32 // BrowserContext/Profile.
31 class BlimpClientContext : public KeyedService { 33 class BlimpClientContext : public KeyedService {
32 public: 34 public:
33 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
34 // Returns a Java object of the type BlimpClientContext for the given 36 // Returns a Java object of the type BlimpClientContext for the given
35 // BlimpClientContext. 37 // BlimpClientContext.
36 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( 38 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject(
37 BlimpClientContext* blimp_client_context); 39 BlimpClientContext* blimp_client_context);
38 #endif // defined(OS_ANDROID) 40 #endif // defined(OS_ANDROID)
39 41
40 // Creates a BlimpClientContext. The implementation of this function 42 // Creates a BlimpClientContext. The implementation of this function
41 // depends on whether the core or dummy implementation of Blimp has been 43 // depends on whether the core or dummy implementation of Blimp has been
42 // linked in. 44 // linked in.
43 // The |io_thread_task_runner| must be the task runner to use for IO 45 // The |io_thread_task_runner| must be the task runner to use for IO
44 // operations. 46 // operations.
45 // The |file_thread_task_runner| must be the task runner to use for file 47 // The |file_thread_task_runner| must be the task runner to use for file
46 // operations. 48 // operations.
49 // |compositor_dependencies| is a support object that provides all embedder
50 // dependencies required by internal compositors.
47 static BlimpClientContext* Create( 51 static BlimpClientContext* Create(
48 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, 52 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
49 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner); 53 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
54 std::unique_ptr<CompositorDependencies> compositor_dependencies);
50 55
51 // The delegate provides all the required functionality from the embedder. 56 // The delegate provides all the required functionality from the embedder.
52 virtual void SetDelegate(BlimpClientContextDelegate* delegate) = 0; 57 virtual void SetDelegate(BlimpClientContextDelegate* delegate) = 0;
53 58
54 // Creates a new BlimpContents. 59 // Creates a new BlimpContents.
55 // TODO(mlliu): Currently we want to have a single BlimpContents. If there is 60 // TODO(mlliu): Currently we want to have a single BlimpContents. If there is
56 // an existing contents, return nullptr (http://crbug.com/642558). 61 // an existing contents, return nullptr (http://crbug.com/642558).
57 virtual std::unique_ptr<BlimpContents> CreateBlimpContents() = 0; 62 virtual std::unique_ptr<BlimpContents> CreateBlimpContents() = 0;
58 63
59 // Start authentication flow and connection to engine. 64 // Start authentication flow and connection to engine.
60 virtual void Connect() = 0; 65 virtual void Connect() = 0;
61 66
62 protected: 67 protected:
63 BlimpClientContext() = default; 68 BlimpClientContext() = default;
64 69
65 private: 70 private:
66 DISALLOW_COPY_AND_ASSIGN(BlimpClientContext); 71 DISALLOW_COPY_AND_ASSIGN(BlimpClientContext);
67 }; 72 };
68 73
69 } // namespace client 74 } // namespace client
70 } // namespace blimp 75 } // namespace blimp
71 76
72 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_ 77 #endif // BLIMP_CLIENT_PUBLIC_BLIMP_CLIENT_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698