Chromium Code Reviews| 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 "blimp/net/blimp_message_receiver.h" | |
| 11 #include "content/public/browser/web_contents_delegate.h" | |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 | |
| 14 namespace content { | |
| 15 class BrowserContext; | |
| 16 class WebContents; | |
| 17 } | |
| 18 | |
| 19 namespace blimp { | |
| 20 | |
| 21 class BlimpClientSession; | |
| 22 class BlimpMessage; | |
| 23 | |
| 24 namespace engine { | |
| 25 | |
| 26 class BlimpBrowserContext; | |
| 27 class BlimpScreen; | |
| 28 | |
| 29 class BlimpEngineSession : public BlimpMessageReceiver, | |
| 30 public content::WebContentsDelegate { | |
| 31 public: | |
| 32 explicit BlimpEngineSession(scoped_ptr<BlimpBrowserContext> browser_context); | |
| 33 ~BlimpEngineSession() override; | |
| 34 | |
| 35 void Initialize(); | |
| 36 | |
| 37 BlimpBrowserContext* browser_context() { return browser_context_.get(); } | |
| 38 | |
| 39 void AttachClientSession(scoped_ptr<BlimpClientSession> client_session); | |
| 40 | |
| 41 private: | |
| 42 // Creates a new WebContents, which will be indexed by |target_tab_id|. | |
| 43 void CreateWebContents(const int target_tab_id); | |
| 44 | |
| 45 // Navigates the target tab to the |url|. | |
| 46 void LoadUrl(const int target_tab_id, const GURL& url); | |
| 47 | |
| 48 // BlimpMessageReceiver implementation. | |
| 49 net::Error OnBlimpMessage(const BlimpMessage& message) override; | |
| 50 | |
| 51 // content::WebContentsDelegate implementation. | |
| 52 content::WebContents* OpenURLFromTab( | |
| 53 content::WebContents* source, | |
| 54 const content::OpenURLParams& params) override; | |
| 55 void AddNewContents(content::WebContents* source, | |
| 56 content::WebContents* new_contents, | |
| 57 WindowOpenDisposition disposition, | |
| 58 const gfx::Rect& initial_rect, | |
| 59 bool user_gesture, | |
| 60 bool* was_blocked) override; | |
| 61 void RequestToLockMouse(content::WebContents* web_contents, | |
| 62 bool user_gesture, | |
| 63 bool last_unlocked_by_target) override; | |
| 64 void CloseContents(content::WebContents* source) override; | |
| 65 void ActivateContents(content::WebContents* contents) override; | |
| 66 void DeactivateContents(content::WebContents* contents) override; | |
| 67 | |
| 68 // Sets up and owns |new_contents|. | |
| 69 void PlatformSetContents(scoped_ptr<content::WebContents> new_contents); | |
| 70 | |
| 71 scoped_ptr<BlimpBrowserContext> browser_context_; | |
| 72 scoped_ptr<BlimpScreen> screen_; | |
| 73 | |
| 74 // only one web_contents is supported for blimp 0.5 | |
|
Kevin M
2015/10/15 22:01:56
Capitalize "Only"
haibinlu
2015/10/15 22:12:32
Done.
| |
| 75 scoped_ptr<content::WebContents> web_contents_; | |
| 76 | |
| 77 // Currently attached client session. | |
| 78 scoped_ptr<BlimpClientSession> client_session_; | |
| 79 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); | |
| 80 }; | |
| 81 | |
| 82 } // namespace engine | |
| 83 } // namespace blimp | |
| 84 | |
| 85 #endif // BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ | |
| OLD | NEW |