| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/background_contents_service.h" | 5 #include "chrome/browser/background_contents_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); | 140 prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); |
| 141 if (!contents) | 141 if (!contents) |
| 142 return; | 142 return; |
| 143 for (DictionaryValue::key_iterator it = contents->begin_keys(); | 143 for (DictionaryValue::key_iterator it = contents->begin_keys(); |
| 144 it != contents->end_keys(); ++it) { | 144 it != contents->end_keys(); ++it) { |
| 145 DictionaryValue* dict; | 145 DictionaryValue* dict; |
| 146 contents->GetDictionaryWithoutPathExpansion(*it, &dict); | 146 contents->GetDictionaryWithoutPathExpansion(*it, &dict); |
| 147 string16 frame_name; | 147 string16 frame_name; |
| 148 std::string url; | 148 std::string url; |
| 149 dict->GetString(kUrlKey, &url); | 149 dict->GetString(kUrlKey, &url); |
| 150 dict->GetStringAsUTF16(kFrameNameKey, &frame_name); | 150 dict->GetString(kFrameNameKey, &frame_name); |
| 151 CreateBackgroundContents(profile, | 151 CreateBackgroundContents(profile, |
| 152 GURL(url), | 152 GURL(url), |
| 153 frame_name, | 153 frame_name, |
| 154 UTF8ToUTF16(*it)); | 154 UTF8ToUTF16(*it)); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void BackgroundContentsService::CreateBackgroundContents( | 158 void BackgroundContentsService::CreateBackgroundContents( |
| 159 Profile* profile, | 159 Profile* profile, |
| 160 const GURL& url, | 160 const GURL& url, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 if (contents == it->second.contents) | 293 if (contents == it->second.contents) |
| 294 return it->first; | 294 return it->first; |
| 295 } | 295 } |
| 296 return EmptyString16(); | 296 return EmptyString16(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { | 300 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { |
| 301 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); | 301 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); |
| 302 } | 302 } |
| OLD | NEW |