OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" | 5 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 // If Goodies page hasn't been shown yet, and Chromebook isn't too old, create | 79 // If Goodies page hasn't been shown yet, and Chromebook isn't too old, create |
80 // GoodiesDisplayer to observe BrowserList. Return |true| if checking age. | 80 // GoodiesDisplayer to observe BrowserList. Return |true| if checking age. |
81 // static | 81 // static |
82 bool GoodiesDisplayer::Init() { | 82 bool GoodiesDisplayer::Init() { |
83 const bool can_show = g_browser_process->local_state()->GetBoolean( | 83 const bool can_show = g_browser_process->local_state()->GetBoolean( |
84 prefs::kCanShowOobeGoodiesPage); | 84 prefs::kCanShowOobeGoodiesPage); |
85 if (can_show) { | 85 if (can_show) { |
86 base::PostTaskWithTraitsAndReplyWithResult( | 86 base::PostTaskWithTraitsAndReplyWithResult( |
87 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 87 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
88 base::TaskPriority::BACKGROUND), | |
89 base::Bind(&CheckGoodiesPrefAgainstOobeTimestamp), | 88 base::Bind(&CheckGoodiesPrefAgainstOobeTimestamp), |
90 base::Bind(&UpdateGoodiesPrefCantShow)); | 89 base::Bind(&UpdateGoodiesPrefCantShow)); |
91 } | 90 } |
92 return can_show; | 91 return can_show; |
93 } | 92 } |
94 | 93 |
95 // static | 94 // static |
96 void GoodiesDisplayer::InitForTesting(GoodiesDisplayerTestInfo* test_info) { | 95 void GoodiesDisplayer::InitForTesting(GoodiesDisplayerTestInfo* test_info) { |
97 CHECK(!g_test_info) << "GoodiesDisplayer::InitForTesting called twice"; | 96 CHECK(!g_test_info) << "GoodiesDisplayer::InitForTesting called twice"; |
98 g_test_info = test_info; | 97 g_test_info = test_info; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(&Delete)); | 142 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(&Delete)); |
144 } | 143 } |
145 | 144 |
146 GoodiesDisplayerTestInfo::GoodiesDisplayerTestInfo() | 145 GoodiesDisplayerTestInfo::GoodiesDisplayerTestInfo() |
147 : days_since_oobe(0), setup_complete(false) {} | 146 : days_since_oobe(0), setup_complete(false) {} |
148 | 147 |
149 GoodiesDisplayerTestInfo::~GoodiesDisplayerTestInfo() {} | 148 GoodiesDisplayerTestInfo::~GoodiesDisplayerTestInfo() {} |
150 | 149 |
151 } // namespace first_run | 150 } // namespace first_run |
152 } // namespace chromeos | 151 } // namespace chromeos |
OLD | NEW |