| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 BackgroundContents* contents = new BackgroundContents( | 172 BackgroundContents* contents = new BackgroundContents( |
| 173 SiteInstance::CreateSiteInstanceForURL(profile, url), MSG_ROUTING_NONE); | 173 SiteInstance::CreateSiteInstanceForURL(profile, url), MSG_ROUTING_NONE); |
| 174 | 174 |
| 175 contents_map_[application_id].contents = contents; | 175 contents_map_[application_id].contents = contents; |
| 176 contents_map_[application_id].frame_name = frame_name; | 176 contents_map_[application_id].frame_name = frame_name; |
| 177 | 177 |
| 178 RenderViewHost* render_view_host = contents->render_view_host(); | 178 RenderViewHost* render_view_host = contents->render_view_host(); |
| 179 // TODO(atwilson): Create RenderViews asynchronously to avoid increasing | 179 // TODO(atwilson): Create RenderViews asynchronously to avoid increasing |
| 180 // startup latency (http://crbug.com/47236). | 180 // startup latency (http://crbug.com/47236). |
| 181 render_view_host->CreateRenderView(profile->GetRequestContext(), frame_name); | 181 render_view_host->CreateRenderView(frame_name); |
| 182 render_view_host->NavigateToURL(url); | 182 render_view_host->NavigateToURL(url); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void BackgroundContentsService::RegisterBackgroundContents( | 185 void BackgroundContentsService::RegisterBackgroundContents( |
| 186 BackgroundContents* background_contents) { | 186 BackgroundContents* background_contents) { |
| 187 DCHECK(IsTracked(background_contents)); | 187 DCHECK(IsTracked(background_contents)); |
| 188 if (!prefs_) | 188 if (!prefs_) |
| 189 return; | 189 return; |
| 190 | 190 |
| 191 // We store the first URL we receive for a given application. If there's | 191 // We store the first URL we receive for a given application. If there's |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (contents == it->second.contents) | 279 if (contents == it->second.contents) |
| 280 return it->first; | 280 return it->first; |
| 281 } | 281 } |
| 282 return EmptyString16(); | 282 return EmptyString16(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 // static | 285 // static |
| 286 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { | 286 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { |
| 287 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); | 287 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); |
| 288 } | 288 } |
| OLD | NEW |