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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // TODO(atwilson): Change this to send a BACKGROUND_CONTENTS_CREATED | 189 // TODO(atwilson): Change this to send a BACKGROUND_CONTENTS_CREATED |
190 // notification when we have a listener outside of BackgroundContentsService. | 190 // notification when we have a listener outside of BackgroundContentsService. |
191 BackgroundContentsOpenedDetails details = {contents, | 191 BackgroundContentsOpenedDetails details = {contents, |
192 frame_name, | 192 frame_name, |
193 application_id}; | 193 application_id}; |
194 BackgroundContentsOpened(&details); | 194 BackgroundContentsOpened(&details); |
195 | 195 |
196 RenderViewHost* render_view_host = contents->render_view_host(); | 196 RenderViewHost* render_view_host = contents->render_view_host(); |
197 // TODO(atwilson): Create RenderViews asynchronously to avoid increasing | 197 // TODO(atwilson): Create RenderViews asynchronously to avoid increasing |
198 // startup latency (http://crbug.com/47236). | 198 // startup latency (http://crbug.com/47236). |
199 render_view_host->CreateRenderView(profile->GetRequestContext(), frame_name); | 199 render_view_host->CreateRenderView(frame_name); |
200 render_view_host->NavigateToURL(url); | 200 render_view_host->NavigateToURL(url); |
201 } | 201 } |
202 | 202 |
203 void BackgroundContentsService::RegisterBackgroundContents( | 203 void BackgroundContentsService::RegisterBackgroundContents( |
204 BackgroundContents* background_contents) { | 204 BackgroundContents* background_contents) { |
205 DCHECK(IsTracked(background_contents)); | 205 DCHECK(IsTracked(background_contents)); |
206 if (!prefs_) | 206 if (!prefs_) |
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 |
(...skipping 83 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 |