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

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: fix Created 8 years, 12 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
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 const string16& appid = GetParentApplicationId(background_contents); 495 const string16& appid = GetParentApplicationId(background_contents);
496 DictionaryValue* current; 496 DictionaryValue* current;
497 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &current)) 497 if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &current))
498 return; 498 return;
499 499
500 // No entry for this application yet, so add one. 500 // No entry for this application yet, so add one.
501 DictionaryValue* dict = new DictionaryValue(); 501 DictionaryValue* dict = new DictionaryValue();
502 dict->SetString(kUrlKey, background_contents->GetURL().spec()); 502 dict->SetString(kUrlKey, background_contents->GetURL().spec());
503 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name); 503 dict->SetString(kFrameNameKey, contents_map_[appid].frame_name);
504 pref->SetWithoutPathExpansion(UTF16ToUTF8(appid), dict); 504 pref->SetWithoutPathExpansion(UTF16ToUTF8(appid), dict);
505 prefs_->ScheduleSavePersistentPrefs();
506 } 505 }
507 506
508 void BackgroundContentsService::UnregisterBackgroundContents( 507 void BackgroundContentsService::UnregisterBackgroundContents(
509 BackgroundContents* background_contents) { 508 BackgroundContents* background_contents) {
510 if (!prefs_) 509 if (!prefs_)
511 return; 510 return;
512 DCHECK(IsTracked(background_contents)); 511 DCHECK(IsTracked(background_contents));
513 const string16 appid = GetParentApplicationId(background_contents); 512 const string16 appid = GetParentApplicationId(background_contents);
514 DictionaryPrefUpdate update(prefs_, prefs::kRegisteredBackgroundContents); 513 DictionaryPrefUpdate update(prefs_, prefs::kRegisteredBackgroundContents);
515 update.Get()->RemoveWithoutPathExpansion(UTF16ToUTF8(appid), NULL); 514 update.Get()->RemoveWithoutPathExpansion(UTF16ToUTF8(appid), NULL);
516 prefs_->ScheduleSavePersistentPrefs();
517 } 515 }
518 516
519 void BackgroundContentsService::ShutdownAssociatedBackgroundContents( 517 void BackgroundContentsService::ShutdownAssociatedBackgroundContents(
520 const string16& appid) { 518 const string16& appid) {
521 BackgroundContents* contents = GetAppBackgroundContents(appid); 519 BackgroundContents* contents = GetAppBackgroundContents(appid);
522 if (contents) { 520 if (contents) {
523 UnregisterBackgroundContents(contents); 521 UnregisterBackgroundContents(contents);
524 // Background contents destructor shuts down the renderer. 522 // Background contents destructor shuts down the renderer.
525 delete contents; 523 delete contents;
526 } 524 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 TabContents* new_contents, 570 TabContents* new_contents,
573 WindowOpenDisposition disposition, 571 WindowOpenDisposition disposition,
574 const gfx::Rect& initial_pos, 572 const gfx::Rect& initial_pos,
575 bool user_gesture) { 573 bool user_gesture) {
576 Browser* browser = BrowserList::GetLastActiveWithProfile( 574 Browser* browser = BrowserList::GetLastActiveWithProfile(
577 Profile::FromBrowserContext(new_contents->GetBrowserContext())); 575 Profile::FromBrowserContext(new_contents->GetBrowserContext()));
578 if (!browser) 576 if (!browser)
579 return; 577 return;
580 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); 578 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture);
581 } 579 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698