1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_
#define CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_
// This file provides declarations and stub definitions for classes we encouter
// during the porting effort. It is not meant to be perminent, and classes will
// be removed from here as they are fleshed out more completely.
#include <string>
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "chrome/browser/browser_process.h"
class Browser;
class CommandLine;
class MetricsService;
class ProfileManager;
class Profile;
class SessionID;
class URLRequestContext;
class WebContents;
//---------------------------------------------------------------------------
// These stubs are for Browser_main()
class Upgrade {
public:
static bool IsBrowserAlreadyRunning() { return false; }
static bool RelaunchChromeBrowser(const CommandLine& command_line) {
return true;
}
static bool SwapNewChromeExeIfPresent() { return true; }
};
class BrowserInit {
public:
// TODO(port): MessageWindow is very windows specific and shouldn't be part of
// BrowserInit at all.
class MessageWindow {
public:
explicit MessageWindow(const std::wstring& user_data_dir) { }
~MessageWindow() { }
bool NotifyOtherProcess() { return false; }
void HuntForZombieChromeProcesses() { }
void Create() { }
void Lock() { }
void Unlock() { }
};
static bool ProcessCommandLine(const CommandLine& parsed_command_line,
const std::wstring& cur_dir,
PrefService* prefs, bool process_startup,
Profile* profile, int* return_code);
static bool LaunchBrowser(const CommandLine& parsed_command_line,
Profile* profile, const std::wstring& cur_dir,
bool process_startup, int* return_code);
private:
static bool LaunchBrowserImpl(const CommandLine& parsed_command_line,
Profile* profile, const std::wstring& cur_dir,
bool process_startup, int* return_code);
};
class FirstRun {
public:
static bool IsChromeFirstRun() { return false; }
static bool ProcessMasterPreferences(const std::wstring& user_data_dir,
const std::wstring& master_prefs_path,
int* preference_details) {
return false;
}
static int ImportNow(Profile* profile, const CommandLine& cmdline) {
return 0;
}
};
class GoogleUpdateSettings {
public:
static bool GetCollectStatsConsent() { return false; }
static bool SetCollectStatsConsent(bool consented) { return false; }
static bool GetBrowser(std::wstring* browser) { return false; }
static bool GetLanguage(std::wstring* language) { return false; }
static bool GetBrand(std::wstring* brand) { return false; }
static bool GetReferral(std::wstring* referral) { return false; }
static bool ClearReferral() { return false; }
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings);
};
class BrowserProcessImpl : public BrowserProcess {
public:
BrowserProcessImpl(const CommandLine& command_line);
virtual ~BrowserProcessImpl();
virtual void EndSession() { }
virtual ResourceDispatcherHost* resource_dispatcher_host() { return NULL; }
virtual MetricsService* metrics_service();
virtual ProfileManager* profile_manager();
virtual PrefService* local_state();
virtual DebuggerWrapper* debugger_wrapper() { return NULL; }
virtual ClipboardService* clipboard_service() { return NULL; }
virtual base::Thread* io_thread() { return NULL; }
virtual base::Thread* file_thread() { return NULL; }
virtual base::Thread* db_thread() { return NULL; }
virtual sandbox::BrokerServices* broker_services() { return NULL; }
virtual IconManager* icon_manager() { return NULL; }
virtual void InitBrokerServices(sandbox::BrokerServices*) { }
virtual AutomationProviderList* InitAutomationProviderList() { return NULL; }
virtual void InitDebuggerWrapper(int port) { }
virtual unsigned int AddRefModule() { return NULL; }
virtual unsigned int ReleaseModule() { return NULL; }
virtual bool IsShuttingDown() { return NULL; }
virtual views::AcceleratorHandler* accelerator_handler() { return NULL; }
virtual printing::PrintJobManager* print_job_manager() { return NULL; }
virtual GoogleURLTracker* google_url_tracker() { return NULL; }
virtual const std::wstring& GetApplicationLocale() { return locale_; }
virtual MemoryModel memory_model() { return MEDIUM_MEMORY_MODEL; }
virtual base::WaitableEvent* shutdown_event() { return NULL; }
private:
void CreateLocalState();
void CreateProfileManager();
void CreateMetricsService();
scoped_ptr<NotificationService> main_notification_service_;
MemoryModel memory_model_;
bool created_local_state_;
scoped_ptr<PrefService> local_state_;
bool created_metrics_service_;
scoped_ptr<MetricsService> metrics_service_;
bool created_profile_manager_;
scoped_ptr<ProfileManager> profile_manager_;
std::wstring locale_;
};
class FirstRunBrowserProcess : public BrowserProcessImpl {
public:
FirstRunBrowserProcess(const CommandLine& command_line)
: BrowserProcessImpl(command_line) {
}
virtual ~FirstRunBrowserProcess() { }
virtual GoogleURLTracker* google_url_tracker() { return NULL; }
private:
DISALLOW_COPY_AND_ASSIGN(FirstRunBrowserProcess);
};
class UserDataManager {
public:
static void Create();
static UserDataManager* Get();
explicit UserDataManager(const std::wstring& user_data_root) { }
private:
// Shared instance.
static UserDataManager* instance_;
};
struct SessionService {
void WindowClosed(const SessionID &) { }
};
class TabRestoreService {
public:
void BrowserClosing(Browser*) { }
void BrowserClosed(Browser*) { }
};
class Profile {
public:
Profile(const std::wstring& user_data_dir);
virtual std::wstring GetPath() { return path_; }
virtual PrefService* GetPrefs();
void ResetTabRestoreService() { }
TabRestoreService* GetTabRestoreService() { return NULL; }
SessionService* GetSessionService() { return NULL; }
bool IsOffTheRecord() { return false; }
URLRequestContext* GetRequestContext() { return NULL; }
virtual Profile* GetOriginalProfile() { return this; }
private:
std::wstring GetPrefFilePath();
std::wstring path_;
scoped_ptr<PrefService> prefs_;
};
class ProfileManager : NonThreadSafe {
public:
ProfileManager() { }
virtual ~ProfileManager() { }
Profile* GetDefaultProfile(const std::wstring& user_data_dir);
static std::wstring GetDefaultProfileDir(const std::wstring& user_data_dir);
static std::wstring GetDefaultProfilePath(const std::wstring& profile_dir);
static void ShutdownSessionServices() { }
private:
DISALLOW_EVIL_CONSTRUCTORS(ProfileManager);
};
class MetricsService {
public:
MetricsService() { }
~MetricsService() { }
void Start() { }
void StartRecordingOnly() { }
void Stop() { }
void SetUserPermitsUpload(bool enabled) { }
};
namespace browser_shutdown {
void ReadLastShutdownInfo();
void Shutdown();
}
namespace browser {
void RegisterAllPrefs(PrefService*, PrefService*);
}
void OpenFirstRunDialog(Profile* profile);
void InstallJankometer(const CommandLine&);
//---------------------------------------------------------------------------
// These stubs are for Browser
class LocationBarView {
public:
void ShowFirstRunBubble() { }
};
class DebuggerWindow : public base::RefCountedThreadSafe<DebuggerWindow> {
public:
};
class TabStripModelDelegate {
public:
};
class TabStripModelObserver {
public:
};
class NavigationController {
public:
};
class TabContentsDelegate {
public:
};
class TabContents {
public:
TabContents() : controller_(new NavigationController) { }
NavigationController* controller() const { return controller_.get(); }
WebContents* AsWebContents() const { return NULL; }
private:
scoped_ptr<NavigationController> controller_;
};
// fake a tab strip, though it can't have any entries because the browser dtor
// checks.
class TabStripModel {
public:
TabStripModel(TabStripModelDelegate* delegate, Profile* profile)
: contents_(new TabContents) { }
virtual ~TabStripModel() { }
bool empty() const { return contents_.get() == NULL; }
int count() const { return contents_.get() ? 1 : 0; }
int selected_index() const { return 0; }
int GetIndexOfController(const NavigationController* controller) const {
return 0;
}
TabContents* GetTabContentsAt(int index) const { return contents_.get(); }
TabContents* GetSelectedTabContents() const { return contents_.get(); }
void SelectTabContentsAt(int index, bool user_gesture) { }
TabContents* AddBlankTab(bool foreground) { return contents_.get(); }
void CloseAllTabs() { contents_.reset(NULL); }
void AddObserver(TabStripModelObserver* observer) { }
void RemoveObserver(TabStripModelObserver* observer) { }
private:
scoped_ptr<TabContents> contents_;
};
class SelectFileDialog : public base::RefCountedThreadSafe<SelectFileDialog> {
public:
class Listener {
public:
};
void ListenerDestroyed() { }
};
class SiteInstance {
public:
};
class DockInfo {
public:
};
class ToolbarModel {
public:
};
#endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_
|