OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <assert.h> | 8 #include <assert.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <iterator> | 13 #include <iterator> |
14 #include <limits> | 14 #include <limits> |
15 #include <memory> | 15 #include <memory> |
16 #include <sstream> | 16 #include <sstream> |
17 | 17 |
18 #include "chrome/install_static/install_details.h" | 18 #include "chrome/install_static/install_details.h" |
19 #include "chrome/install_static/install_modes.h" | 19 #include "chrome/install_static/install_modes.h" |
20 #include "chrome/install_static/policy_path_parser.h" | 20 #include "chrome/install_static/policy_path_parser.h" |
21 #include "chrome/install_static/user_data_dir.h" | 21 #include "chrome/install_static/user_data_dir.h" |
22 #include "chrome_elf/nt_registry/nt_registry.h" | 22 #include "chrome_elf/nt_registry/nt_registry.h" |
| 23 #include "components/version_info/channel.h" |
23 | 24 |
24 namespace install_static { | 25 namespace install_static { |
25 | 26 |
26 ProcessType g_process_type = ProcessType::UNINITIALIZED; | 27 ProcessType g_process_type = ProcessType::UNINITIALIZED; |
27 | 28 |
28 const wchar_t kRegValueChromeStatsSample[] = L"UsageStatsInSample"; | 29 const wchar_t kRegValueChromeStatsSample[] = L"UsageStatsInSample"; |
29 | 30 |
30 // TODO(ananta) | 31 // TODO(ananta) |
31 // http://crbug.com/604923 | 32 // http://crbug.com/604923 |
32 // The constants defined in this file are also defined in chrome/installer and | 33 // The constants defined in this file are also defined in chrome/installer and |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if (official_build != L"1") | 555 if (official_build != L"1") |
555 version->append(L"-devel"); | 556 version->append(L"-devel"); |
556 GetValueFromVersionResource(data.get(), L"ProductShortName", | 557 GetValueFromVersionResource(data.get(), L"ProductShortName", |
557 product_name); | 558 product_name); |
558 GetValueFromVersionResource(data.get(), L"SpecialBuild", special_build); | 559 GetValueFromVersionResource(data.get(), L"SpecialBuild", special_build); |
559 } | 560 } |
560 } | 561 } |
561 *channel_name = GetChromeChannelName(); | 562 *channel_name = GetChromeChannelName(); |
562 } | 563 } |
563 | 564 |
| 565 version_info::Channel GetChromeChannel() { |
| 566 #if defined(GOOGLE_CHROME_BUILD) |
| 567 std::wstring channel_name(GetChromeChannelName()); |
| 568 if (channel_name.empty()) { |
| 569 return version_info::Channel::STABLE; |
| 570 } |
| 571 if (channel_name == L"beta") { |
| 572 return version_info::Channel::BETA; |
| 573 } |
| 574 if (channel_name == L"dev") { |
| 575 return version_info::Channel::DEV; |
| 576 } |
| 577 if (channel_name == L"canary") { |
| 578 return version_info::Channel::CANARY; |
| 579 } |
| 580 #endif |
| 581 |
| 582 return version_info::Channel::UNKNOWN; |
| 583 } |
| 584 |
564 std::wstring GetChromeChannelName() { | 585 std::wstring GetChromeChannelName() { |
565 return InstallDetails::Get().channel(); | 586 return InstallDetails::Get().channel(); |
566 } | 587 } |
567 | 588 |
568 bool MatchPattern(const std::wstring& source, const std::wstring& pattern) { | 589 bool MatchPattern(const std::wstring& source, const std::wstring& pattern) { |
569 assert(pattern.find(L"**") == std::wstring::npos); | 590 assert(pattern.find(L"**") == std::wstring::npos); |
570 return MatchPatternImpl(source, pattern, 0, 0); | 591 return MatchPatternImpl(source, pattern, 0, 0); |
571 } | 592 } |
572 | 593 |
573 std::string UTF16ToUTF8(const std::wstring& source) { | 594 std::string UTF16ToUTF8(const std::wstring& source) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 case ChannelStrategy::ADDITIONAL_PARAMETERS: | 838 case ChannelStrategy::ADDITIONAL_PARAMETERS: |
818 return ChannelFromAdditionalParameters(mode, ap_value); | 839 return ChannelFromAdditionalParameters(mode, ap_value); |
819 case ChannelStrategy::FIXED: | 840 case ChannelStrategy::FIXED: |
820 return mode.default_channel_name; | 841 return mode.default_channel_name; |
821 } | 842 } |
822 | 843 |
823 return std::wstring(); | 844 return std::wstring(); |
824 } | 845 } |
825 | 846 |
826 } // namespace install_static | 847 } // namespace install_static |
OLD | NEW |