| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 for (BackgroundContentsMap::const_iterator it = contents_map_.begin(); | 546 for (BackgroundContentsMap::const_iterator it = contents_map_.begin(); |
| 547 it != contents_map_.end(); ++it) { | 547 it != contents_map_.end(); ++it) { |
| 548 if (contents == it->second.contents) | 548 if (contents == it->second.contents) |
| 549 return it->first; | 549 return it->first; |
| 550 } | 550 } |
| 551 return EmptyString16(); | 551 return EmptyString16(); |
| 552 } | 552 } |
| 553 | 553 |
| 554 // static | 554 // static |
| 555 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { | 555 void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { |
| 556 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); | 556 prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents, |
| 557 false /* don't sync pref */); |
| 557 } | 558 } |
| 558 | 559 |
| 559 void BackgroundContentsService::AddTabContents( | 560 void BackgroundContentsService::AddTabContents( |
| 560 TabContents* new_contents, | 561 TabContents* new_contents, |
| 561 WindowOpenDisposition disposition, | 562 WindowOpenDisposition disposition, |
| 562 const gfx::Rect& initial_pos, | 563 const gfx::Rect& initial_pos, |
| 563 bool user_gesture) { | 564 bool user_gesture) { |
| 564 Browser* browser = BrowserList::GetLastActiveWithProfile( | 565 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 565 new_contents->profile()); | 566 new_contents->profile()); |
| 566 if (!browser) | 567 if (!browser) |
| 567 return; | 568 return; |
| 568 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 569 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
| 569 } | 570 } |
| OLD | NEW |