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

Side by Side Diff: content/browser/browser_main.h

Issue 7840041: Refactor some more BrowserMain code. Move core code that's required by all embedders to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | content/browser/browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_BROWSER_MAIN_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_H_
6 #define CONTENT_BROWSER_BROWSER_MAIN_H_ 6 #define CONTENT_BROWSER_BROWSER_MAIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // method with a well-defined purpose. (Likewise, if you're adding to an 66 // method with a well-defined purpose. (Likewise, if you're adding to an
67 // existing chunk which makes it longer than one or two lines, please move 67 // existing chunk which makes it longer than one or two lines, please move
68 // the code out into a separate method.) 68 // the code out into a separate method.)
69 class BrowserMainParts { 69 class BrowserMainParts {
70 public: 70 public:
71 explicit BrowserMainParts(const MainFunctionParams& parameters); 71 explicit BrowserMainParts(const MainFunctionParams& parameters);
72 virtual ~BrowserMainParts(); 72 virtual ~BrowserMainParts();
73 73
74 // Parts to be called by |BrowserMain()|. 74 // Parts to be called by |BrowserMain()|.
75 void EarlyInitialization(); 75 void EarlyInitialization();
76 void InitializeToolkit();
76 void MainMessageLoopStart(); 77 void MainMessageLoopStart();
77 void InitializeToolkit(); 78 void RunMainMessageLoopParts();
78 79
79 // Temporary function since not all the code from chrome is moved over yet. 80 int result_code() const { return result_code_; }
80 virtual int TemporaryContinue();
81 81
82 protected: 82 protected:
83 // Methods to be overridden to provide platform-specific code; these 83 // Methods to be overridden to provide platform-specific code; these
84 // correspond to the "parts" above. 84 // correspond to the "parts" above.
85 virtual void PreEarlyInitialization(); 85 virtual void PreEarlyInitialization();
86 virtual void PostEarlyInitialization(); 86 virtual void PostEarlyInitialization();
87 virtual void PreMainMessageLoopStart(); 87 virtual void PreMainMessageLoopStart();
88 virtual void PostMainMessageLoopStart(); 88 virtual void PostMainMessageLoopStart();
89 89 virtual void PreMainMessageLoopRun();
90 // Used to initialize NSPR where appropriate. 90 virtual void MainMessageLoopRun();
91 virtual void InitializeSSL(); 91 virtual void PostMainMessageLoopRun();
92 92
93 // Allows an embedder to do any extra toolkit initialization. 93 // Allows an embedder to do any extra toolkit initialization.
94 virtual void ToolkitInitialized(); 94 virtual void ToolkitInitialized();
95 95
96 // Accessors for data members (below) ---------------------------------------- 96 // Accessors for data members (below) ----------------------------------------
97 const MainFunctionParams& parameters() const { 97 const MainFunctionParams& parameters() const {
98 return parameters_; 98 return parameters_;
99 } 99 }
100 const CommandLine& parsed_command_line() const { 100 const CommandLine& parsed_command_line() const {
101 return parsed_command_line_; 101 return parsed_command_line_;
102 } 102 }
103 MessageLoop& main_message_loop() const { 103 MessageLoop& main_message_loop() const {
104 return *main_message_loop_; 104 return *main_message_loop_;
105 } 105 }
106 void set_result_code(int result_code) { result_code_ = result_code; }
106 107
107 private: 108 private:
108 void InitializeMainThread(); 109 void InitializeMainThread();
109 110
110 // Members initialized on construction --------------------------------------- 111 // Members initialized on construction ---------------------------------------
111 112
112 const MainFunctionParams& parameters_; 113 const MainFunctionParams& parameters_;
113 const CommandLine& parsed_command_line_; 114 const CommandLine& parsed_command_line_;
115 int result_code_;
114 116
115 // Members initialized in |MainMessageLoopStart()| --------------------------- 117 // Members initialized in |MainMessageLoopStart()| ---------------------------
116 scoped_ptr<MessageLoop> main_message_loop_; 118 scoped_ptr<MessageLoop> main_message_loop_;
117 scoped_ptr<base::SystemMonitor> system_monitor_; 119 scoped_ptr<base::SystemMonitor> system_monitor_;
118 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; 120 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_;
119 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 121 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
120 scoped_ptr<BrowserThread> main_thread_; 122 scoped_ptr<BrowserThread> main_thread_;
121 123
122 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); 124 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts);
123 }; 125 };
124 126
125 // Perform platform-specific work that needs to be done after the main event 127 // Perform platform-specific work that needs to be done after the main event
126 // loop has ended. The embedder must be sure to call this. 128 // loop has ended. The embedder must be sure to call this.
127 // TODO(jam): change this so that content calls it so that we don't depend on 129 // TODO(jam): change this so that content calls it so that we don't depend on
128 // the embedder. 130 // the embedder.
129 void DidEndMainMessageLoop(); 131 void DidEndMainMessageLoop();
130 132
131 } // namespace content 133 } // namespace content
132 134
133 #endif // CONTENT_BROWSER_BROWSER_MAIN_H_ 135 #endif // CONTENT_BROWSER_BROWSER_MAIN_H_
OLDNEW
« no previous file with comments | « chrome/common/chrome_switches.cc ('k') | content/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698