Chromium Code Reviews| Index: blimp/engine/browser/blimp_engine_session.h |
| diff --git a/blimp/engine/browser/blimp_engine_session.h b/blimp/engine/browser/blimp_engine_session.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2ad727570e1fc0ee69e9cc5562046f27cdad6c61 |
| --- /dev/null |
| +++ b/blimp/engine/browser/blimp_engine_session.h |
| @@ -0,0 +1,80 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ |
| +#define BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ |
| + |
| +#include <string> |
|
Kevin M
2015/10/14 17:52:57
not used
haibinlu
2015/10/15 01:59:28
Done.
|
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "blimp/engine/browser/blimp_client_session_manager_delegate.h" |
| +#include "content/public/browser/web_contents_delegate.h" |
| +#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.
|
| +#include "ui/gfx/geometry/size.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +class WebContents; |
| +} |
| + |
| +namespace blimp { |
| +namespace engine { |
| + |
| +class BlimpBrowserContext; |
| +class BlimpScreen; |
| + |
| +class BlimpEngineSession : public BlimpClientSessionManagerDelegate, |
| + public content::WebContentsDelegate { |
| + public: |
| + explicit BlimpEngineSession(scoped_ptr<BlimpBrowserContext> browser_context); |
| + ~BlimpEngineSession() override; |
| + |
| + void Initialize(); |
| + |
| + // Creates a new WebContents and navigates to the |url|. |
| + // The newly created WebContents will have the client screen size. |
| + void CreateWebContents(const GURL& url); |
| + |
| + // BlimpClientSessionManagerDelegate implementation. |
| + void AttachClientSession(BlimpClientSession* client_session) override; |
| + void DetachClientSession(BlimpClientSession* client_session) override; |
| + |
| + 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.
|
| + |
| + private: |
| + // content::WebContentsDelegate implementation. |
| + content::WebContents* OpenURLFromTab( |
| + content::WebContents* source, |
| + const content::OpenURLParams& params) override; |
| + void AddNewContents(content::WebContents* source, |
| + content::WebContents* new_contents, |
| + WindowOpenDisposition disposition, |
| + const gfx::Rect& initial_rect, |
| + bool user_gesture, |
| + bool* was_blocked) override; |
| + void RequestToLockMouse(content::WebContents* web_contents, |
| + bool user_gesture, |
| + bool last_unlocked_by_target) override; |
| + void CloseContents(content::WebContents* source) override; |
| + void ActivateContents(content::WebContents* contents) override; |
| + void DeactivateContents(content::WebContents* contents) override; |
| + |
| + // Sets up and owns |new_contents|. |
| + void PlatformSetContents(content::WebContents* new_contents); |
| + |
| + scoped_ptr<BlimpBrowserContext> browser_context_; |
| + scoped_ptr<BlimpScreen> screen_; |
| + ScopedVector<content::WebContents> contents_list_; |
| + |
| + // Currently attached client session. |
| + 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.
|
| + DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession); |
| +}; |
| + |
| +} // namespace engine |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_ENGINE_BROWSER_BLIMP_ENGINE_SESSION_H_ |