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

Side by Side Diff: content/public/browser/browser_main_parts.h

Issue 8539038: Add ChromeBrowserMainExtraParts for non main parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify CL. Created 9 years, 1 month 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
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_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 // This class contains different "stages" to be executed by |BrowserMain()|, 14 // This class contains different "stages" to be executed by |BrowserMain()|,
15 // Each stage is represented by a single BrowserMainParts method, called from 15 // Each stage is represented by a single BrowserMainParts method, called from
16 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization()) 16 // the corresponding method in |BrowserMainLoop| (e.g., EarlyInitialization())
17 // which does the following: 17 // which does the following:
18 // - calls a method (e.g., "PreEarlyInitialization()") for each member of 18 // - calls a method (e.g., "PreEarlyInitialization()") which implements
19 // |parts_|. Parts will implement platform or tookit specific code for that 19 // platform / tookit specific code for that stage.
20 // stage.
21 // - calls various methods for things common to all platforms (for that stage). 20 // - calls various methods for things common to all platforms (for that stage).
22 // - calls a method (e.g., "PostEarlyInitialization()") for platform-specific 21 // - calls a method (e.g., "PostEarlyInitialization()") for platform-specific
23 // code to be called after the common code. 22 // code to be called after the common code.
24 // 23 //
25 // Stages: 24 // Stages:
26 // - EarlyInitialization: things which should be done as soon as possible on 25 // - EarlyInitialization: things which should be done as soon as possible on
27 // program start (such as setting up signal handlers) and things to be done 26 // program start (such as setting up signal handlers) and things to be done
28 // at some generic time before the start of the main message loop. 27 // at some generic time before the start of the main message loop.
29 // - MainMessageLoopStart: things beginning with the start of the main message 28 // - MainMessageLoopStart: things beginning with the start of the main message
30 // loop and ending with initialization of the main thread; platform-specific 29 // loop and ending with initialization of the main thread; platform-specific
(...skipping 11 matching lines...) Expand all
42 // from one of the platform-specific |Pre/Post...()| methods; do this if the 41 // from one of the platform-specific |Pre/Post...()| methods; do this if the
43 // code is unique to a platform type. Or (2) execute it from one of the 42 // code is unique to a platform type. Or (2) execute it from one of the
44 // "parts" (e.g., |EarlyInitialization()|) and provide platform-specific 43 // "parts" (e.g., |EarlyInitialization()|) and provide platform-specific
45 // implementations of your code (in a virtual method); do this if you need to 44 // implementations of your code (in a virtual method); do this if you need to
46 // provide different implementations across most/all platforms. 45 // provide different implementations across most/all platforms.
47 // - Unless your new code is just one or two lines, put it into a separate 46 // - Unless your new code is just one or two lines, put it into a separate
48 // method with a well-defined purpose. (Likewise, if you're adding to an 47 // method with a well-defined purpose. (Likewise, if you're adding to an
49 // existing chunk which makes it longer than one or two lines, please move 48 // existing chunk which makes it longer than one or two lines, please move
50 // the code out into a separate method.) 49 // the code out into a separate method.)
51 // 50 //
52 // There can be any number of "Parts". These should be constructed in
53 // ContentBrowserClient::CreateBrowserMainParts. Each stage will be called
54 // for each part in the order it was added. Destruction is in the inverse order.
55 class CONTENT_EXPORT BrowserMainParts { 51 class CONTENT_EXPORT BrowserMainParts {
56 public: 52 public:
57 BrowserMainParts() {} 53 BrowserMainParts() {}
58 virtual ~BrowserMainParts() {} 54 virtual ~BrowserMainParts() {}
59 55
60 virtual void PreEarlyInitialization() = 0; 56 virtual void PreEarlyInitialization() = 0;
61 57
62 virtual void PostEarlyInitialization() = 0; 58 virtual void PostEarlyInitialization() = 0;
63 59
64 virtual void PreMainMessageLoopStart() = 0; 60 virtual void PreMainMessageLoopStart() = 0;
65 61
62 virtual void PostMainMessageLoopStart() = 0;
63
66 // Allows an embedder to do any extra toolkit initialization. 64 // Allows an embedder to do any extra toolkit initialization.
67 virtual void ToolkitInitialized() = 0; 65 virtual void ToolkitInitialized() = 0;
68 66
69 virtual void PostMainMessageLoopStart() = 0;
70
71 virtual void PreMainMessageLoopRun() = 0; 67 virtual void PreMainMessageLoopRun() = 0;
72 68
73 // Returns true if the message loop was run, false otherwise. 69 // Returns true if the message loop was run, false otherwise.
70 // If this returns false, the default implementation will be run.
74 // May set |result_code|, which will be returned by |BrowserMain()|. 71 // May set |result_code|, which will be returned by |BrowserMain()|.
75 // If no BrowserMainParts implementations return true, the default
76 // implementation will be run.
77 virtual bool MainMessageLoopRun(int* result_code) = 0; 72 virtual bool MainMessageLoopRun(int* result_code) = 0;
78 73
79 virtual void PostMainMessageLoopRun() = 0; 74 virtual void PostMainMessageLoopRun() = 0;
80 75
81 private: 76 private:
82 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts); 77 DISALLOW_COPY_AND_ASSIGN(BrowserMainParts);
83 }; 78 };
84 79
85 } // namespace content 80 } // namespace content
86 81
87 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_ 82 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_MAIN_PARTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698