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

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

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

Powered by Google App Engine
This is Rietveld 408576698