OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 14 class BrowserThread; |
| 15 class CommandLine; |
| 16 class HighResolutionTimerManager; |
| 17 class MessageLoop; |
| 18 |
| 19 struct MainFunctionParams; |
| 20 |
| 21 namespace base { |
| 22 class SystemMonitor; |
| 23 } |
| 24 |
| 25 namespace net { |
| 26 class NetworkChangeNotifier; |
| 27 } |
| 28 |
| 29 namespace content { |
| 30 |
| 31 class BrowserMainParts; |
| 32 |
| 33 // Implements the main browser loop stages called from |BrowserMain()|. |
| 34 // See comments in browser_main_parts.h for additional info. |
| 35 class BrowserMainLoop { |
| 36 public: |
| 37 explicit BrowserMainLoop(const MainFunctionParams& parameters); |
| 38 virtual ~BrowserMainLoop(); |
| 39 |
| 40 void Init(); |
| 41 |
| 42 void EarlyInitialization(); |
| 43 void InitializeToolkit(); |
| 44 void MainMessageLoopStart(); |
| 45 void RunMainMessageLoopParts(bool* completed_main_message_loop); |
| 46 void MainMessageLoopRun(); |
| 47 |
| 48 int GetResultCode() const { return result_code_; } |
| 49 |
| 50 private: |
| 51 void InitializeMainThread(); |
| 52 |
| 53 // Members initialized on construction --------------------------------------- |
| 54 const MainFunctionParams& parameters_; |
| 55 const CommandLine& parsed_command_line_; |
| 56 int result_code_; |
| 57 |
| 58 // Vector of BrowserMainParts set by CreateBrowserMainParts ------------------ |
| 59 // The BrowserParts fucntions for each part are called in the order added. |
| 60 // They are released (destroyed) in the reverse order. |
| 61 std::vector<BrowserMainParts*> parts_list_; |
| 62 |
| 63 // Members initialized in |MainMessageLoopStart()| --------------------------- |
| 64 scoped_ptr<MessageLoop> main_message_loop_; |
| 65 scoped_ptr<base::SystemMonitor> system_monitor_; |
| 66 scoped_ptr<HighResolutionTimerManager> hi_res_timer_manager_; |
| 67 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
| 68 scoped_ptr<BrowserThread> main_thread_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); |
| 71 }; |
| 72 |
| 73 } // namespace content |
| 74 |
| 75 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ |
OLD | NEW |