Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / after_startup_task_utils.h
blob3c8f8de0f21e8c718844f8f9db915a646c9812dd
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
6 #define CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_
8 #include "base/basictypes.h"
9 #include "base/bind.h"
10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h"
13 namespace android {
14 class AfterStartupTaskUtilsJNI;
17 namespace base {
18 class TaskRunner;
20 namespace tracked_objects {
21 class Location;
24 class AfterStartupTaskUtils {
25 public:
26 // Observes startup and when complete runs tasks that have accrued.
27 static void StartMonitoringStartup();
29 // Used to augment the behavior of BrowserThread::PostAfterStartupTask
30 // for chrome. Tasks are queued until startup is complete.
31 // Note: see browser_thread.h
32 static void PostTask(const tracked_objects::Location& from_here,
33 const scoped_refptr<base::TaskRunner>& task_runner,
34 const base::Closure& task);
36 // Returns true if browser startup is complete. Only use this on a one-off
37 // basis; If you need to poll this function constantly, use the above
38 // PostTask() API instead.
39 static bool IsBrowserStartupComplete();
41 private:
42 friend class AfterStartupTaskTest;
43 friend class android::AfterStartupTaskUtilsJNI;
44 friend class InProcessBrowserTest;
45 FRIEND_TEST_ALL_PREFIXES(AfterStartupTaskTest, IsStartupComplete);
46 FRIEND_TEST_ALL_PREFIXES(AfterStartupTaskTest, PostTask);
48 static void SetBrowserStartupIsComplete();
49 static void UnsafeResetForTesting();
51 DISALLOW_IMPLICIT_CONSTRUCTORS(AfterStartupTaskUtils);
54 #endif // CHROME_BROWSER_AFTER_STARTUP_TASK_UTILS_H_