OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
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 BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ | |
6 #define BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/scoped_vector.h" | |
11 #include "blimp/net/blimp_message_receiver.h" | |
12 #include "content/public/browser/web_contents_delegate.h" | |
13 #include "ui/gfx/geometry/size.h" | |
14 | |
15 namespace content { | |
16 class BrowserContext; | |
17 class WebContents; | |
18 } | |
19 | |
20 namespace blimp { | |
21 | |
22 class BlimpClientSession; | |
23 class BlimpMessage; | |
24 | |
25 namespace engine { | |
26 | |
27 class BlimpBrowserContext; | |
28 class BlimpScreen; | |
29 | |
30 class BlimpEngineSession : public BlimpMessageReceiver, | |
31 public content::WebContentsDelegate { | |
32 public: | |
33 explicit BlimpEngineSession(scoped_ptr<BlimpBrowserContext> browser_context); | |
34 ~BlimpEngineSession() override; | |
35 | |
36 void Initialize(); | |
37 | |
38 BlimpBrowserContext* browser_context() { return browser_context_.get(); } | |
39 | |
40 void AttachClientSession(scoped_ptr<BlimpClientSession> client_session); | |
41 | |
42 private: | |
43 // Creates a new WebContents and navigates to the |url|. | |
44 // The newly created WebContents will have the client screen size. | |
45 void CreateWebContents(const GURL& url); | |
Kevin M
2015/10/15 17:14:03
It feels strange that NEW_TAB is so conflated with
| |
46 | |
47 // BlimpMessageReceiver implementation. | |
48 net::Error OnBlimpMessage(const BlimpMessage& message) override; | |
49 | |
50 // content::WebContentsDelegate implementation. | |
51 content::WebContents* OpenURLFromTab( | |
52 content::WebContents* source, | |
53 const content::OpenURLParams& params) override; | |
54 void AddNewContents(content::WebContents* source, | |
55 content::WebContents* new_contents, | |
56 WindowOpenDisposition disposition, | |
57 const gfx::Rect& initial_rect, | |
58 bool user_gesture, | |
59 bool* was_blocked) override; | |
60 void RequestToLockMouse(content::WebContents* web_contents, | |
61 bool user_gesture, | |
62 bool last_unlocked_by_target) override; | |
63 void CloseContents(content::WebContents* source) override; | |
64 void ActivateContents(content::WebContents* contents) override; | |
65 void DeactivateContents(content::WebContents* contents) override; | |
66 | |
67 // Sets up and owns |new_contents|. | |
68 void PlatformSetContents(content::WebContents* new_contents); | |
69 | |
70 scoped_ptr<BlimpBrowserContext> browser_context_; | |
71 scoped_ptr<BlimpScreen> screen_; | |
72 ScopedVector<content::WebContents> contents_list_; | |
73 | |
74 // Currently attached client session. | |
75 scoped_ptr<BlimpClientSession> client_session_; | |
76 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); | |
77 }; | |
78 | |
79 } // namespace engine | |
80 } // namespace blimp | |
81 | |
82 #endif // BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ | |
OLD | NEW |