Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/background/background_contents_service.cc

Issue 8198007: Remove PrefService::ScheduleSavePersistentPrefs and SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/background_contents_service.h" 5 #include "chrome/browser/background/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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 const string16& appid = GetParentApplicationId(background_contents); 491 const string16& appid = GetParentApplicationId(background_contents);
492 DictionaryValue* current; 492 DictionaryValue* current;
493 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &current)) 493 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &current))
494 return; 494 return;
495 495
496 // No entry for this application yet, so add one. 496 // No entry for this application yet, so add one.
497 DictionaryValue* dict = new DictionaryValue(); 497 DictionaryValue* dict = new DictionaryValue();
498 dict->SetString(kUrlKey, background_contents->GetURL().spec()); 498 dict->SetString(kUrlKey, background_contents->GetURL().spec());
499 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name); 499 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name);
500 pref->SetWithoutPathExpansion(UTF16ToUTF8(appid), dict); 500 pref->SetWithoutPathExpansion(UTF16ToUTF8(appid), dict);
501 prefs_->ScheduleSavePersistentPrefs();
502 } 501 }
503 502
504 void BackgroundContentsService::UnregisterBackgroundContents( 503 void BackgroundContentsService::UnregisterBackgroundContents(
505 BackgroundContents* background_contents) { 504 BackgroundContents* background_contents) {
506 if (!prefs_) 505 if (!prefs_)
507 return; 506 return;
508 DCHECK(IsTracked(background_contents)); 507 DCHECK(IsTracked(background_contents));
509 const string16 appid = GetParentApplicationId(background_contents); 508 const string16 appid = GetParentApplicationId(background_contents);
510 DictionaryPrefUpdate update(prefs_, prefs::kRegisteredBackgroundContents); 509 DictionaryPrefUpdate update(prefs_, prefs::kRegisteredBackgroundContents);
511 update.Get()->RemoveWithoutPathExpansion(UTF16ToUTF8(appid), NULL); 510 update.Get()->RemoveWithoutPathExpansion(UTF16ToUTF8(appid), NULL);
512 prefs_->ScheduleSavePersistentPrefs();
513 } 511 }
514 512
515 void BackgroundContentsService::ShutdownAssociatedBackgroundContents( 513 void BackgroundContentsService::ShutdownAssociatedBackgroundContents(
516 const string16& appid) { 514 const string16& appid) {
517 BackgroundContents* contents = GetAppBackgroundContents(appid); 515 BackgroundContents* contents = GetAppBackgroundContents(appid);
518 if (contents) { 516 if (contents) {
519 UnregisterBackgroundContents(contents); 517 UnregisterBackgroundContents(contents);
520 // Background contents destructor shuts down the renderer. 518 // Background contents destructor shuts down the renderer.
521 delete contents; 519 delete contents;
522 } 520 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 TabContents* new_contents, 566 TabContents* new_contents,
569 WindowOpenDisposition disposition, 567 WindowOpenDisposition disposition,
570 const gfx::Rect& initial_pos, 568 const gfx::Rect& initial_pos,
571 bool user_gesture) { 569 bool user_gesture) {
572 Browser* browser = BrowserList::GetLastActiveWithProfile( 570 Browser* browser = BrowserList::GetLastActiveWithProfile(
573 Profile::FromBrowserContext(new_contents->browser_context())); 571 Profile::FromBrowserContext(new_contents->browser_context()));
574 if (!browser) 572 if (!browser)
575 return; 573 return;
576 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); 574 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture);
577 } 575 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | chrome/browser/chromeos/login/user_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698