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

Side by Side Diff: chromecast/shell/browser/cast_browser_main_parts.cc

Issue 396213009: Removes CastBrowserMainParts::GetInstance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « chromecast/shell/browser/cast_browser_main_parts.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/shell/browser/cast_browser_main_parts.h" 5 #include "chromecast/shell/browser/cast_browser_main_parts.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chromecast/net/network_change_notifier_cast.h" 8 #include "chromecast/net/network_change_notifier_cast.h"
9 #include "chromecast/net/network_change_notifier_factory_cast.h" 9 #include "chromecast/net/network_change_notifier_factory_cast.h"
10 #include "chromecast/service/cast_service.h" 10 #include "chromecast/service/cast_service.h"
11 #include "chromecast/shell/browser/cast_browser_context.h" 11 #include "chromecast/shell/browser/cast_browser_context.h"
12 #include "chromecast/shell/browser/url_request_context_factory.h" 12 #include "chromecast/shell/browser/url_request_context_factory.h"
13 13
14 namespace chromecast { 14 namespace chromecast {
15 namespace shell { 15 namespace shell {
16 16
17 // static
18 CastBrowserMainParts* CastBrowserMainParts::instance_ = NULL;
19
20 namespace { 17 namespace {
21 18
22 struct DefaultCommandLineSwitch { 19 struct DefaultCommandLineSwitch {
23 const char* const switch_name; 20 const char* const switch_name;
24 const char* const switch_value; 21 const char* const switch_value;
25 }; 22 };
26 23
27 DefaultCommandLineSwitch g_default_switches[] = { 24 DefaultCommandLineSwitch g_default_switches[] = {
28 { "enable-webrtc-hw-decoding", "" }, 25 { "enable-webrtc-hw-decoding", "" },
29 { "disable-plugins", "" }, 26 { "disable-plugins", "" },
(...skipping 13 matching lines...) Expand all
43 40
44 } // namespace 41 } // namespace
45 42
46 CastBrowserMainParts::CastBrowserMainParts( 43 CastBrowserMainParts::CastBrowserMainParts(
47 const content::MainFunctionParams& parameters, 44 const content::MainFunctionParams& parameters,
48 URLRequestContextFactory* url_request_context_factory) 45 URLRequestContextFactory* url_request_context_factory)
49 : BrowserMainParts(), 46 : BrowserMainParts(),
50 url_request_context_factory_(url_request_context_factory) { 47 url_request_context_factory_(url_request_context_factory) {
51 CommandLine* command_line = CommandLine::ForCurrentProcess(); 48 CommandLine* command_line = CommandLine::ForCurrentProcess();
52 AddDefaultCommandLineSwitches(command_line); 49 AddDefaultCommandLineSwitches(command_line);
53 DCHECK(instance_ == NULL);
54 instance_ = this;
55 } 50 }
56 51
57 CastBrowserMainParts::~CastBrowserMainParts() { 52 CastBrowserMainParts::~CastBrowserMainParts() {
58 DCHECK(instance_ == this);
59 instance_ = NULL;
60 } 53 }
61 54
62 void CastBrowserMainParts::PreMainMessageLoopStart() { 55 void CastBrowserMainParts::PreMainMessageLoopStart() {
63 net::NetworkChangeNotifier::SetFactory( 56 net::NetworkChangeNotifier::SetFactory(
64 new NetworkChangeNotifierFactoryCast()); 57 new NetworkChangeNotifierFactoryCast());
65 } 58 }
66 59
67 void CastBrowserMainParts::PostMainMessageLoopStart() { 60 void CastBrowserMainParts::PostMainMessageLoopStart() {
68 NOTIMPLEMENTED(); 61 NOTIMPLEMENTED();
69 } 62 }
(...skipping 14 matching lines...) Expand all
84 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { 77 bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) {
85 base::MessageLoopForUI::current()->Run(); 78 base::MessageLoopForUI::current()->Run();
86 return true; 79 return true;
87 } 80 }
88 81
89 void CastBrowserMainParts::PostMainMessageLoopRun() { 82 void CastBrowserMainParts::PostMainMessageLoopRun() {
90 cast_service_->Stop(); 83 cast_service_->Stop();
91 browser_context_.reset(); 84 browser_context_.reset();
92 } 85 }
93 86
94 // static
95 CastBrowserMainParts* CastBrowserMainParts::GetInstance() {
96 DCHECK(instance_ != NULL);
97 return instance_;
98 }
99
100 } // namespace shell 87 } // namespace shell
101 } // namespace chromecast 88 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/shell/browser/cast_browser_main_parts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698