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

Side by Side Diff: chrome/browser/themes/browser_theme_provider.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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) 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/themes/browser_theme_provider.h" 5 #include "chrome/browser/themes/browser_theme_provider.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extensions_service.h" 10 #include "chrome/browser/extensions/extensions_service.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 void BrowserThemeProvider::SavePackName(const FilePath& pack_path) { 595 void BrowserThemeProvider::SavePackName(const FilePath& pack_path) {
596 profile_->GetPrefs()->SetFilePath( 596 profile_->GetPrefs()->SetFilePath(
597 prefs::kCurrentThemePackFilename, pack_path); 597 prefs::kCurrentThemePackFilename, pack_path);
598 } 598 }
599 599
600 void BrowserThemeProvider::SaveThemeID(const std::string& id) { 600 void BrowserThemeProvider::SaveThemeID(const std::string& id) {
601 profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, id); 601 profile_->GetPrefs()->SetString(prefs::kCurrentThemeID, id);
602 } 602 }
603 603
604 void BrowserThemeProvider::BuildFromExtension(const Extension* extension) { 604 void BrowserThemeProvider::BuildFromExtension(const Extension* extension) {
605 scoped_refptr<BrowserThemePack> pack = 605 scoped_refptr<BrowserThemePack> pack(
606 BrowserThemePack::BuildFromExtension(extension); 606 BrowserThemePack::BuildFromExtension(extension));
607 if (!pack.get()) { 607 if (!pack.get()) {
608 // TODO(erg): We've failed to install the theme; perhaps we should tell the 608 // TODO(erg): We've failed to install the theme; perhaps we should tell the
609 // user? http://crbug.com/34780 609 // user? http://crbug.com/34780
610 LOG(ERROR) << "Could not load theme."; 610 LOG(ERROR) << "Could not load theme.";
611 return; 611 return;
612 } 612 }
613 613
614 // Write the packed file to disk. 614 // Write the packed file to disk.
615 FilePath pack_path = extension->path().Append(chrome::kThemePackFilename); 615 FilePath pack_path = extension->path().Append(chrome::kThemePackFilename);
616 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 616 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
617 new WritePackToDiskTask(pack, pack_path)); 617 new WritePackToDiskTask(pack, pack_path));
618 618
619 SavePackName(pack_path); 619 SavePackName(pack_path);
620 theme_pack_ = pack; 620 theme_pack_ = pack;
621 } 621 }
622 622
623 void BrowserThemeProvider::OnInfobarDisplayed() { 623 void BrowserThemeProvider::OnInfobarDisplayed() {
624 number_of_infobars_++; 624 number_of_infobars_++;
625 } 625 }
626 626
627 void BrowserThemeProvider::OnInfobarDestroyed() { 627 void BrowserThemeProvider::OnInfobarDestroyed() {
628 number_of_infobars_--; 628 number_of_infobars_--;
629 629
630 if (number_of_infobars_ == 0) 630 if (number_of_infobars_ == 0)
631 RemoveUnusedThemes(); 631 RemoveUnusedThemes();
632 } 632 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack_unittest.cc ('k') | chrome/browser/user_style_sheet_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698