| OLD | NEW |
| 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 #include "chrome/browser/extensions/extension_dom_ui.h" | 5 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ListValue* page_overrides; | 211 ListValue* page_overrides; |
| 212 if (!all_overrides->GetList(UTF8ToWide(page), &page_overrides)) { | 212 if (!all_overrides->GetList(UTF8ToWide(page), &page_overrides)) { |
| 213 // If it's being unregistered, it should already be in the list. | 213 // If it's being unregistered, it should already be in the list. |
| 214 NOTREACHED(); | 214 NOTREACHED(); |
| 215 return; | 215 return; |
| 216 } else { | 216 } else { |
| 217 UnregisterAndReplaceOverride(page, profile, page_overrides, override); | 217 UnregisterAndReplaceOverride(page, profile, page_overrides, override); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 RenderViewHost* ExtensionDOMUI::GetRenderViewHost() { |
| 222 return tab_contents() ? tab_contents()->render_view_host() : NULL; |
| 223 } |
| 224 |
| 221 // static | 225 // static |
| 222 void ExtensionDOMUI::UnregisterChromeURLOverrides( | 226 void ExtensionDOMUI::UnregisterChromeURLOverrides( |
| 223 Profile* profile, const Extension::URLOverrideMap& overrides) { | 227 Profile* profile, const Extension::URLOverrideMap& overrides) { |
| 224 if (overrides.empty()) | 228 if (overrides.empty()) |
| 225 return; | 229 return; |
| 226 PrefService* prefs = profile->GetPrefs(); | 230 PrefService* prefs = profile->GetPrefs(); |
| 227 DictionaryValue* all_overrides = | 231 DictionaryValue* all_overrides = |
| 228 prefs->GetMutableDictionary(kExtensionURLOverrides); | 232 prefs->GetMutableDictionary(kExtensionURLOverrides); |
| 229 Extension::URLOverrideMap::const_iterator iter = overrides.begin(); | 233 Extension::URLOverrideMap::const_iterator iter = overrides.begin(); |
| 230 for (;iter != overrides.end(); ++iter) { | 234 for (;iter != overrides.end(); ++iter) { |
| 231 std::wstring page = UTF8ToWide((*iter).first); | 235 std::wstring page = UTF8ToWide((*iter).first); |
| 232 ListValue* page_overrides; | 236 ListValue* page_overrides; |
| 233 if (!all_overrides->GetList(page, &page_overrides)) { | 237 if (!all_overrides->GetList(page, &page_overrides)) { |
| 234 // If it's being unregistered, it should already be in the list. | 238 // If it's being unregistered, it should already be in the list. |
| 235 NOTREACHED(); | 239 NOTREACHED(); |
| 236 continue; | 240 continue; |
| 237 } else { | 241 } else { |
| 238 StringValue override((*iter).second.spec()); | 242 StringValue override((*iter).second.spec()); |
| 239 UnregisterAndReplaceOverride((*iter).first, profile, | 243 UnregisterAndReplaceOverride((*iter).first, profile, |
| 240 page_overrides, &override); | 244 page_overrides, &override); |
| 241 } | 245 } |
| 242 } | 246 } |
| 243 } | 247 } |
| OLD | NEW |