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

Side by Side Diff: blimp/engine/browser/blimp_browser_main_parts.cc

Issue 1403083002: [Blimp] Adds Blimp EngineSession and ClientSession skeleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 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 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 #include "blimp/engine/browser/blimp_browser_main_parts.h" 5 #include "blimp/engine/browser/blimp_browser_main_parts.h"
6 6
7 #include "base/command_line.h" 7 #include "blimp/engine/browser/blimp_browser_context.h"
8 #include "blimp/engine/browser/blimp_window.h" 8 #include "blimp/engine/browser/blimp_client_session_manager.h"
9 #include "blimp/engine/browser/blimp_client_session_manager_delegate.h"
Kevin M 2015/10/14 17:52:56 Not used
haibinlu 2015/10/15 01:59:27 Done.
10 #include "blimp/engine/browser/blimp_engine_session.h"
9 #include "blimp/engine/ui/blimp_screen.h" 11 #include "blimp/engine/ui/blimp_screen.h"
10 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
11 #include "net/base/net_module.h" 13 #include "net/base/net_module.h"
12 #include "net/log/net_log.h" 14 #include "net/log/net_log.h"
13 #include "url/gurl.h" 15
16 #include "ui/base/ime/input_method_initializer.h"
Kevin M 2015/10/14 17:52:56 Not used
haibinlu 2015/10/15 01:59:27 Done.
14 17
15 namespace blimp { 18 namespace blimp {
16 namespace engine { 19 namespace engine {
17 20
18 namespace {
19
20 const char kDefaultURL[] = "https://www.google.com/";
21
22 GURL GetStartupURL() {
23 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
24 const base::CommandLine::StringVector& args = command_line->GetArgs();
25 if (args.empty())
26 return GURL(kDefaultURL);
27
28 GURL url(args[0]);
29 if (url.is_valid() && url.has_scheme())
30 return url;
31
32 return GURL(kDefaultURL);
33 }
34
35 } // namespace
36
37 BlimpBrowserMainParts::BlimpBrowserMainParts( 21 BlimpBrowserMainParts::BlimpBrowserMainParts(
38 const content::MainFunctionParams& parameters) {} 22 const content::MainFunctionParams& parameters) {}
39 23
40 BlimpBrowserMainParts::~BlimpBrowserMainParts() {} 24 BlimpBrowserMainParts::~BlimpBrowserMainParts() {}
41 25
42 void BlimpBrowserMainParts::PreMainMessageLoopRun() { 26 void BlimpBrowserMainParts::PreMainMessageLoopRun() {
43 net_log_.reset(new net::NetLog()); 27 net_log_.reset(new net::NetLog());
44 browser_context_.reset(new BlimpBrowserContext(false, net_log_.get())); 28 scoped_ptr<BlimpBrowserContext> browser_context(
45 BlimpWindow::Create(browser_context_.get(), GetStartupURL(), nullptr, 29 new BlimpBrowserContext(false, net_log_.get()));
46 gfx::Size()); 30 engine_session_.reset(new BlimpEngineSession(browser_context.Pass()));
47 } 31 client_session_manager_.reset(
48 32 new BlimpClientSessionManager(engine_session_.get(), net_log_.get()));
49 int BlimpBrowserMainParts::PreCreateThreads() { 33 engine_session_->Initialize();
50 screen_.reset(new BlimpScreen); 34 // TODO(haibinlu): remove this after a real client session can be attached.
51 DCHECK(!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)); 35 client_session_manager_->AttachTestClientSession();
52 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
53 return 0;
54 } 36 }
55 37
56 void BlimpBrowserMainParts::PostMainMessageLoopRun() { 38 void BlimpBrowserMainParts::PostMainMessageLoopRun() {
57 browser_context_.reset(); 39 client_session_manager_.reset();
40 engine_session_.reset();
Kevin M 2015/10/14 17:52:56 Is this necessary? These will be destroyed automat
haibinlu 2015/10/15 01:59:27 per offline discussion, it's for cleaning up objec
41 }
42
43 BlimpBrowserContext* BlimpBrowserMainParts::browser_context() {
44 DCHECK(engine_session_);
Kevin M 2015/10/14 17:52:56 This can be kept as a simple getter - the dcheck i
haibinlu 2015/10/15 01:59:27 Done.
45 return engine_session_->browser_context();
58 } 46 }
59 47
60 } // namespace engine 48 } // namespace engine
61 } // namespace blimp 49 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698