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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/extensions/extensions_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
16 #include "chrome/browser/renderer_host/site_instance.h" | 16 #include "chrome/browser/renderer_host/site_instance.h" |
17 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
22 #include "chrome/common/notification_service.h" | 22 #include "chrome/common/notification_service.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // Loads all background contents whose urls have been stored in prefs. | 126 // Loads all background contents whose urls have been stored in prefs. |
127 void BackgroundContentsService::LoadBackgroundContentsFromPrefs( | 127 void BackgroundContentsService::LoadBackgroundContentsFromPrefs( |
128 Profile* profile) { | 128 Profile* profile) { |
129 if (!prefs_) | 129 if (!prefs_) |
130 return; | 130 return; |
131 const DictionaryValue* contents = | 131 const DictionaryValue* contents = |
132 prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); | 132 prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); |
133 if (!contents) | 133 if (!contents) |
134 return; | 134 return; |
135 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 135 ExtensionService* extensions_service = profile->GetExtensionService(); |
136 DCHECK(extensions_service); | 136 DCHECK(extensions_service); |
137 for (DictionaryValue::key_iterator it = contents->begin_keys(); | 137 for (DictionaryValue::key_iterator it = contents->begin_keys(); |
138 it != contents->end_keys(); ++it) { | 138 it != contents->end_keys(); ++it) { |
139 DictionaryValue* dict; | 139 DictionaryValue* dict; |
140 contents->GetDictionaryWithoutPathExpansion(*it, &dict); | 140 contents->GetDictionaryWithoutPathExpansion(*it, &dict); |
141 string16 frame_name; | 141 string16 frame_name; |
142 std::string url; | 142 std::string url; |
143 dict->GetString(kUrlKey, &url); | 143 dict->GetString(kUrlKey, &url); |
144 dict->GetString(kFrameNameKey, &frame_name); | 144 dict->GetString(kFrameNameKey, &frame_name); |
145 | 145 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 TabContents* new_contents, | 307 TabContents* new_contents, |
308 WindowOpenDisposition disposition, | 308 WindowOpenDisposition disposition, |
309 const gfx::Rect& initial_pos, | 309 const gfx::Rect& initial_pos, |
310 bool user_gesture) { | 310 bool user_gesture) { |
311 Browser* browser = BrowserList::GetLastActiveWithProfile( | 311 Browser* browser = BrowserList::GetLastActiveWithProfile( |
312 new_contents->profile()); | 312 new_contents->profile()); |
313 if (!browser) | 313 if (!browser) |
314 return; | 314 return; |
315 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 315 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
316 } | 316 } |
OLD | NEW |