OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/search/search.h" | 5 #include "chrome/browser/ui/search/search.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
11 | 11 |
12 namespace { | |
13 | |
14 static bool s_is_instant_extended_api_enabled_for_testing = false; | |
dhollowa
2012/12/04 01:24:49
Let's not do this.
Prefer to add:
CommandLine*
sail
2012/12/04 01:41:12
Unfotunately that's not enough since the function
dhollowa
2012/12/04 01:56:16
If you sync, you'll find that it is enough now. I
sail
2012/12/04 04:26:30
Done.
I had one big oversight in my previous code
dhollowa
2012/12/04 05:17:53
Gosh yes, that is pretty ugly. Not to rat-hole he
sail
2012/12/04 18:00:07
Done.
Good idea!
| |
15 | |
16 } | |
17 | |
12 namespace chrome { | 18 namespace chrome { |
13 namespace search { | 19 namespace search { |
14 | 20 |
15 bool IsInstantExtendedAPIEnabled(const Profile* profile) { | 21 bool IsInstantExtendedAPIEnabled(const Profile* profile) { |
22 if (s_is_instant_extended_api_enabled_for_testing) | |
23 return true; | |
24 | |
16 return VersionInfo::GetChannel() <= VersionInfo::CHANNEL_DEV && | 25 return VersionInfo::GetChannel() <= VersionInfo::CHANNEL_DEV && |
17 !profile->IsOffTheRecord() && | 26 !profile->IsOffTheRecord() && |
18 CommandLine::ForCurrentProcess()->HasSwitch( | 27 CommandLine::ForCurrentProcess()->HasSwitch( |
19 switches::kEnableInstantExtendedAPI); | 28 switches::kEnableInstantExtendedAPI); |
20 } | 29 } |
21 | 30 |
31 void EnableInstantExtendedAPIForTesting() { | |
32 s_is_instant_extended_api_enabled_for_testing = true; | |
33 } | |
34 | |
22 } // namespace search | 35 } // namespace search |
23 } // namespace chrome | 36 } // namespace chrome |
OLD | NEW |