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 <string> | |
|
Kevin M
2015/10/14 17:52:57
not used
haibinlu
2015/10/15 01:59:28
Done.
| |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "blimp/engine/browser/blimp_client_session_manager_delegate.h" | |
| 14 #include "content/public/browser/web_contents_delegate.h" | |
| 15 #include "content/public/browser/web_contents_observer.h" | |
|
Kevin M
2015/10/14 17:52:57
not used
haibinlu
2015/10/15 01:59:28
Done.
| |
| 16 #include "ui/gfx/geometry/size.h" | |
| 17 | |
| 18 namespace content { | |
| 19 class BrowserContext; | |
| 20 class WebContents; | |
| 21 } | |
| 22 | |
| 23 namespace blimp { | |
| 24 namespace engine { | |
| 25 | |
| 26 class BlimpBrowserContext; | |
| 27 class BlimpScreen; | |
| 28 | |
| 29 class BlimpEngineSession : public BlimpClientSessionManagerDelegate, | |
| 30 public content::WebContentsDelegate { | |
| 31 public: | |
| 32 explicit BlimpEngineSession(scoped_ptr<BlimpBrowserContext> browser_context); | |
| 33 ~BlimpEngineSession() override; | |
| 34 | |
| 35 void Initialize(); | |
| 36 | |
| 37 // Creates a new WebContents and navigates to the |url|. | |
| 38 // The newly created WebContents will have the client screen size. | |
| 39 void CreateWebContents(const GURL& url); | |
| 40 | |
| 41 // BlimpClientSessionManagerDelegate implementation. | |
| 42 void AttachClientSession(BlimpClientSession* client_session) override; | |
| 43 void DetachClientSession(BlimpClientSession* client_session) override; | |
| 44 | |
| 45 BlimpBrowserContext* browser_context() { return browser_context_.get(); } | |
|
Kevin M
2015/10/14 17:52:57
Move this above the overrides
haibinlu
2015/10/15 01:59:28
Done.
| |
| 46 | |
| 47 private: | |
| 48 // content::WebContentsDelegate implementation. | |
| 49 content::WebContents* OpenURLFromTab( | |
| 50 content::WebContents* source, | |
| 51 const content::OpenURLParams& params) override; | |
| 52 void AddNewContents(content::WebContents* source, | |
| 53 content::WebContents* new_contents, | |
| 54 WindowOpenDisposition disposition, | |
| 55 const gfx::Rect& initial_rect, | |
| 56 bool user_gesture, | |
| 57 bool* was_blocked) override; | |
| 58 void RequestToLockMouse(content::WebContents* web_contents, | |
| 59 bool user_gesture, | |
| 60 bool last_unlocked_by_target) override; | |
| 61 void CloseContents(content::WebContents* source) override; | |
| 62 void ActivateContents(content::WebContents* contents) override; | |
| 63 void DeactivateContents(content::WebContents* contents) override; | |
| 64 | |
| 65 // Sets up and owns |new_contents|. | |
| 66 void PlatformSetContents(content::WebContents* new_contents); | |
| 67 | |
| 68 scoped_ptr<BlimpBrowserContext> browser_context_; | |
| 69 scoped_ptr<BlimpScreen> screen_; | |
| 70 ScopedVector<content::WebContents> contents_list_; | |
| 71 | |
| 72 // Currently attached client session. | |
| 73 BlimpClientSession* client_session_ = nullptr; | |
|
Kevin M
2015/10/14 17:52:57
:-O
Wow, this is allowed now. Yay.
haibinlu
2015/10/15 01:59:28
Acknowledged.
| |
| 74 DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); | |
| 75 }; | |
| 76 | |
| 77 } // namespace engine | |
| 78 } // namespace blimp | |
| 79 | |
| 80 #endif // BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ | |
| OLD | NEW |