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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return; | 207 return; |
208 | 208 |
209 // We store the first URL we receive for a given application. If there's | 209 // We store the first URL we receive for a given application. If there's |
210 // already an entry for this application, no need to do anything. | 210 // already an entry for this application, no need to do anything. |
211 // TODO(atwilson): Verify that this is the desired behavior based on developer | 211 // TODO(atwilson): Verify that this is the desired behavior based on developer |
212 // feedback (http://crbug.com/47118). | 212 // feedback (http://crbug.com/47118). |
213 DictionaryValue* pref = prefs_->GetMutableDictionary( | 213 DictionaryValue* pref = prefs_->GetMutableDictionary( |
214 prefs::kRegisteredBackgroundContents); | 214 prefs::kRegisteredBackgroundContents); |
215 const string16& appid = GetParentApplicationId(background_contents); | 215 const string16& appid = GetParentApplicationId(background_contents); |
216 DictionaryValue* current; | 216 DictionaryValue* current; |
217 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToWide(appid), ¤t)) | 217 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), ¤t)) |
218 return; | 218 return; |
219 | 219 |
220 // No entry for this application yet, so add one. | 220 // No entry for this application yet, so add one. |
221 DictionaryValue* dict = new DictionaryValue(); | 221 DictionaryValue* dict = new DictionaryValue(); |
222 dict->SetString(kUrlKey, background_contents->GetURL().spec()); | 222 dict->SetString(kUrlKey, background_contents->GetURL().spec()); |
223 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name); | 223 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name); |
224 pref->SetWithoutPathExpansion(UTF16ToWide(appid), dict); | 224 pref->SetWithoutPathExpansion(UTF16ToWide(appid), dict); |
225 prefs_->ScheduleSavePersistentPrefs(); | 225 prefs_->ScheduleSavePersistentPrefs(); |
226 } | 226 } |
227 | 227 |
(...skipping 65 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 |