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 // chrome_tab.cc : Implementation of DLL Exports. | 5 // chrome_tab.cc : Implementation of DLL Exports. |
6 | 6 |
7 // Need to include this before the ATL headers below. | 7 // Need to include this before the ATL headers below. |
8 #include "chrome_frame/chrome_tab.h" | 8 #include "chrome_frame/chrome_tab.h" |
9 | 9 |
10 #include <atlsecurity.h> | 10 #include <atlsecurity.h> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // - Overall the time saved will always be less than total time spent | 306 // - Overall the time saved will always be less than total time spent |
307 // paging in chrome | 307 // paging in chrome |
308 // - We are not sure when the chrome 'warm up' will age out from the | 308 // - We are not sure when the chrome 'warm up' will age out from the |
309 // boot prefetch file. | 309 // boot prefetch file. |
310 // | 310 // |
311 // The idea here is to try this out on chrome frame dev channel | 311 // The idea here is to try this out on chrome frame dev channel |
312 // and see if it produces a significant drift in startup numbers. | 312 // and see if it produces a significant drift in startup numbers. |
313 HRESULT SetupRunOnce() { | 313 HRESULT SetupRunOnce() { |
314 HRESULT result = E_FAIL; | 314 HRESULT result = E_FAIL; |
315 | 315 |
316 string16 channel_name; | 316 base::string16 channel_name; |
317 if (base::win::GetVersion() < base::win::VERSION_VISTA && | 317 if (base::win::GetVersion() < base::win::VERSION_VISTA && |
318 GoogleUpdateSettings::GetChromeChannelAndModifiers(true, &channel_name)) { | 318 GoogleUpdateSettings::GetChromeChannelAndModifiers(true, &channel_name)) { |
319 std::transform(channel_name.begin(), channel_name.end(), | 319 std::transform(channel_name.begin(), channel_name.end(), |
320 channel_name.begin(), tolower); | 320 channel_name.begin(), tolower); |
321 // Use this only for the dev channel. | 321 // Use this only for the dev channel. |
322 if (channel_name.find(L"dev") != string16::npos) { | 322 if (channel_name.find(L"dev") != base::string16::npos) { |
323 HKEY hive = HKEY_CURRENT_USER; | 323 HKEY hive = HKEY_CURRENT_USER; |
324 if (IsSystemProcess()) { | 324 if (IsSystemProcess()) { |
325 // For system installs, our updates will be running as SYSTEM which | 325 // For system installs, our updates will be running as SYSTEM which |
326 // makes writing to a RunOnce key under HKCU not so terribly useful. | 326 // makes writing to a RunOnce key under HKCU not so terribly useful. |
327 hive = HKEY_LOCAL_MACHINE; | 327 hive = HKEY_LOCAL_MACHINE; |
328 } | 328 } |
329 | 329 |
330 RegKey run_once; | 330 RegKey run_once; |
331 LONG ret = run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE); | 331 LONG ret = run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE); |
332 if (ret == ERROR_SUCCESS) { | 332 if (ret == ERROR_SUCCESS) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 const wchar_t* const kMimeHandlerKeyValues[] = { | 585 const wchar_t* const kMimeHandlerKeyValues[] = { |
586 L"ChromeTab.ChromeActiveDocument", | 586 L"ChromeTab.ChromeActiveDocument", |
587 L"ChromeTab.ChromeActiveDocument.1", | 587 L"ChromeTab.ChromeActiveDocument.1", |
588 }; | 588 }; |
589 | 589 |
590 // Returns true if the values are present or absent in |root_key|'s Secure Mime | 590 // Returns true if the values are present or absent in |root_key|'s Secure Mime |
591 // Handlers key based on |for_installed|. Returns false if the values are not as | 591 // Handlers key based on |for_installed|. Returns false if the values are not as |
592 // expected or if an error occurred. | 592 // expected or if an error occurred. |
593 bool MimeHandlerKeyIsConfigured(bool for_install, HKEY root_key) { | 593 bool MimeHandlerKeyIsConfigured(bool for_install, HKEY root_key) { |
594 string16 key_name(kInternetSettings); | 594 base::string16 key_name(kInternetSettings); |
595 key_name.append(L"\\Secure Mime Handlers"); | 595 key_name.append(L"\\Secure Mime Handlers"); |
596 RegKey key(root_key, key_name.c_str(), KEY_QUERY_VALUE); | 596 RegKey key(root_key, key_name.c_str(), KEY_QUERY_VALUE); |
597 if (!key.Valid()) | 597 if (!key.Valid()) |
598 return false; | 598 return false; |
599 | 599 |
600 for (size_t i = 0; i < arraysize(kMimeHandlerKeyValues); ++i) { | 600 for (size_t i = 0; i < arraysize(kMimeHandlerKeyValues); ++i) { |
601 DWORD value = 0; | 601 DWORD value = 0; |
602 LONG result = key.ReadValueDW(kMimeHandlerKeyValues[i], &value); | 602 LONG result = key.ReadValueDW(kMimeHandlerKeyValues[i], &value); |
603 if (for_install) { | 603 if (for_install) { |
604 if (result != ERROR_SUCCESS || value != 1) | 604 if (result != ERROR_SUCCESS || value != 1) |
605 return false; | 605 return false; |
606 } else { | 606 } else { |
607 if (result != ERROR_FILE_NOT_FOUND) | 607 if (result != ERROR_FILE_NOT_FOUND) |
608 return false; | 608 return false; |
609 } | 609 } |
610 } | 610 } |
611 return true; | 611 return true; |
612 } | 612 } |
613 | 613 |
614 HRESULT SetOrDeleteMimeHandlerKey(bool set, HKEY root_key) { | 614 HRESULT SetOrDeleteMimeHandlerKey(bool set, HKEY root_key) { |
615 string16 key_name(kInternetSettings); | 615 base::string16 key_name(kInternetSettings); |
616 key_name.append(L"\\Secure Mime Handlers"); | 616 key_name.append(L"\\Secure Mime Handlers"); |
617 RegKey key(root_key, key_name.c_str(), KEY_SET_VALUE); | 617 RegKey key(root_key, key_name.c_str(), KEY_SET_VALUE); |
618 if (!key.Valid()) | 618 if (!key.Valid()) |
619 return false; | 619 return false; |
620 | 620 |
621 HRESULT result = S_OK; | 621 HRESULT result = S_OK; |
622 for (size_t i = 0; i < arraysize(kMimeHandlerKeyValues); ++i) { | 622 for (size_t i = 0; i < arraysize(kMimeHandlerKeyValues); ++i) { |
623 LONG intermediate = set ? | 623 LONG intermediate = set ? |
624 key.WriteValue(kMimeHandlerKeyValues[i], 1) : | 624 key.WriteValue(kMimeHandlerKeyValues[i], 1) : |
625 key.DeleteValue(kMimeHandlerKeyValues[i]); | 625 key.DeleteValue(kMimeHandlerKeyValues[i]); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 HRESULT hr = CustomRegistration(ALL, FALSE, false); | 1027 HRESULT hr = CustomRegistration(ALL, FALSE, false); |
1028 return hr; | 1028 return hr; |
1029 } | 1029 } |
1030 | 1030 |
1031 // Object entries go here instead of with each object, so that we can move | 1031 // Object entries go here instead of with each object, so that we can move |
1032 // the objects to a lib. Also reduces magic. | 1032 // the objects to a lib. Also reduces magic. |
1033 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) | 1033 OBJECT_ENTRY_AUTO(CLSID_ChromeFrameBHO, Bho) |
1034 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) | 1034 OBJECT_ENTRY_AUTO(__uuidof(ChromeActiveDocument), ChromeActiveDocument) |
1035 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) | 1035 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex) |
1036 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) | 1036 OBJECT_ENTRY_AUTO(__uuidof(ChromeProtocol), ChromeProtocol) |
OLD | NEW |