Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome_frame/chrome_tab.cc

Issue 259025: Add the chromeframe tag to the user agent header at runtime instead of static... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame.gyp ('k') | chrome_frame/html_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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
7 // Include without path to make GYP build see it.
8 #include "chrome_tab.h" // NOLINT
9
10 #include <atlsecurity.h>
11
6 #include "base/at_exit.h" 12 #include "base/at_exit.h"
7 #include "base/command_line.h" 13 #include "base/command_line.h"
8 #include "base/file_util.h" 14 #include "base/file_util.h"
9 #include "base/file_version_info.h" 15 #include "base/file_version_info.h"
10 #include "base/logging.h" 16 #include "base/logging.h"
11 #include "base/path_service.h" 17 #include "base/path_service.h"
12 #include "base/registry.h" 18 #include "base/registry.h"
13 #include "base/string_piece.h" 19 #include "base/string_piece.h"
14 #include "base/string_util.h" 20 #include "base/string_util.h"
15 #include "base/sys_string_conversions.h" 21 #include "base/sys_string_conversions.h"
16 #include "base/win_util.h" 22 #include "base/win_util.h"
17 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
18 #include "grit/chrome_frame_resources.h" 24 #include "grit/chrome_frame_resources.h"
19 #include "chrome_frame/bho.h" 25 #include "chrome_frame/bho.h"
20 #include "chrome_frame/chrome_frame_automation.h" 26 #include "chrome_frame/chrome_frame_automation.h"
21 #include "chrome_frame/chrome_frame_reporting.h" 27 #include "chrome_frame/chrome_frame_reporting.h"
22 #include "chrome_frame/chrome_launcher.h" 28 #include "chrome_frame/chrome_launcher.h"
23 #include "chrome_frame/resource.h" 29 #include "chrome_frame/resource.h"
24 #include "chrome_frame/utils.h" 30 #include "chrome_frame/utils.h"
25 31
26 // Include without path to make GYP build see it.
27 #include "chrome_tab.h" // NOLINT
28 #include <atlsecurity.h>
29
30 static const wchar_t kBhoRegistryPath[] = 32 static const wchar_t kBhoRegistryPath[] =
31 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" 33 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"
32 L"\\Browser Helper Objects"; 34 L"\\Browser Helper Objects";
33 35
34 const wchar_t kInternetSettings[] = 36 const wchar_t kInternetSettings[] =
35 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; 37 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
36 38
37 const wchar_t kBhoNoLoadExplorerValue[] = L"NoExplorer"; 39 const wchar_t kBhoNoLoadExplorerValue[] = L"NoExplorer";
38 40
39 class ChromeTabModule 41 class ChromeTabModule
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 #ifdef _MANAGED 143 #ifdef _MANAGED
142 #pragma managed(pop) 144 #pragma managed(pop)
143 #endif 145 #endif
144 146
145 const wchar_t kPostPlatformUAKey[] = 147 const wchar_t kPostPlatformUAKey[] =
146 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\" 148 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\"
147 L"User Agent\\Post Platform"; 149 L"User Agent\\Post Platform";
148 const wchar_t kClockUserAgent[] = L"chromeframe"; 150 const wchar_t kClockUserAgent[] = L"chromeframe";
149 151
150 // To delete the clock user agent, set value to NULL. 152 // To delete the clock user agent, set value to NULL.
153 // TODO(tommi): Remove this method when it's no longer used.
151 HRESULT SetClockUserAgent(const wchar_t* value) { 154 HRESULT SetClockUserAgent(const wchar_t* value) {
152 HRESULT hr; 155 HRESULT hr;
153 RegKey ua_key; 156 RegKey ua_key;
154 if (ua_key.Create(HKEY_LOCAL_MACHINE, kPostPlatformUAKey, KEY_WRITE)) { 157 if (ua_key.Create(HKEY_LOCAL_MACHINE, kPostPlatformUAKey, KEY_WRITE)) {
155 if (value) { 158 if (value) {
156 ua_key.WriteValue(kClockUserAgent, value); 159 ua_key.WriteValue(kClockUserAgent, value);
157 } else { 160 } else {
158 ua_key.DeleteValue(kClockUserAgent); 161 ua_key.DeleteValue(kClockUserAgent);
159 } 162 }
160 hr = S_OK; 163 hr = S_OK;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (!ie_bho_key.CreateKey(bho_class_id_as_string, KEY_READ | KEY_WRITE)) { 210 if (!ie_bho_key.CreateKey(bho_class_id_as_string, KEY_READ | KEY_WRITE)) {
208 DLOG(WARNING) << "Failed to create bho registry key under " 211 DLOG(WARNING) << "Failed to create bho registry key under "
209 << kBhoRegistryPath 212 << kBhoRegistryPath
210 << " for write"; 213 << " for write";
211 return E_FAIL; 214 return E_FAIL;
212 } 215 }
213 216
214 ie_bho_key.WriteValue(kBhoNoLoadExplorerValue, 1); 217 ie_bho_key.WriteValue(kBhoNoLoadExplorerValue, 1);
215 DLOG(INFO) << "Registered ChromeTab BHO"; 218 DLOG(INFO) << "Registered ChromeTab BHO";
216 219
217 SetClockUserAgent(L"1"); 220 // We now add the chromeframe user agent at runtime.
221 // SetClockUserAgent(L"1");
218 RefreshElevationPolicy(); 222 RefreshElevationPolicy();
219 return S_OK; 223 return S_OK;
220 } 224 }
221 225
222 HRESULT UnregisterChromeTabBHO() { 226 HRESULT UnregisterChromeTabBHO() {
227 // TODO(tommi): remove this in future versions.
223 SetClockUserAgent(NULL); 228 SetClockUserAgent(NULL);
224 229
225 RegKey ie_bho_key; 230 RegKey ie_bho_key;
226 if (!ie_bho_key.Open(HKEY_LOCAL_MACHINE, kBhoRegistryPath, 231 if (!ie_bho_key.Open(HKEY_LOCAL_MACHINE, kBhoRegistryPath,
227 KEY_READ | KEY_WRITE)) { 232 KEY_READ | KEY_WRITE)) {
228 DLOG(WARNING) << "Failed to open registry key " 233 DLOG(WARNING) << "Failed to open registry key "
229 << kBhoRegistryPath 234 << kBhoRegistryPath
230 << " for write."; 235 << " for write.";
231 return E_FAIL; 236 return E_FAIL;
232 } 237 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 sd.GetDacl(&new_dacl); 491 sd.GetDacl(&new_dacl);
487 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); 492 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ);
488 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { 493 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) {
489 result = SetOrDeleteMimeHandlerKey(enable); 494 result = SetOrDeleteMimeHandlerKey(enable);
490 } 495 }
491 } 496 }
492 497
493 backup.RestoreSecurity(object_name.c_str()); 498 backup.RestoreSecurity(object_name.c_str());
494 return result; 499 return result;
495 } 500 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame.gyp ('k') | chrome_frame/html_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698