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

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

Issue 10686005: Add methods to add DataPack from open files (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_pack.h" 5 #include "chrome/browser/themes/browser_theme_pack.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( 381 scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack(
382 FilePath path, const std::string& expected_id) { 382 FilePath path, const std::string& expected_id) {
383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
384 // Allow IO on UI thread due to deep-seated theme design issues. 384 // Allow IO on UI thread due to deep-seated theme design issues.
385 // (see http://crbug.com/80206) 385 // (see http://crbug.com/80206)
386 base::ThreadRestrictions::ScopedAllowIO allow_io; 386 base::ThreadRestrictions::ScopedAllowIO allow_io;
387 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); 387 scoped_refptr<BrowserThemePack> pack(new BrowserThemePack);
388 pack->data_pack_.reset( 388 pack->data_pack_.reset(
389 new ui::DataPack(ui::SCALE_FACTOR_100P)); 389 new ui::DataPack(ui::SCALE_FACTOR_100P));
390 390
391 if (!pack->data_pack_->Load(path)) { 391 if (!pack->data_pack_->LoadFromPath(path)) {
392 LOG(ERROR) << "Failed to load theme data pack."; 392 LOG(ERROR) << "Failed to load theme data pack.";
393 return NULL; 393 return NULL;
394 } 394 }
395 395
396 base::StringPiece pointer; 396 base::StringPiece pointer;
397 if (!pack->data_pack_->GetStringPiece(kHeaderID, &pointer)) 397 if (!pack->data_pack_->GetStringPiece(kHeaderID, &pointer))
398 return NULL; 398 return NULL;
399 pack->header_ = reinterpret_cast<BrowserThemePackHeader*>(const_cast<char*>( 399 pack->header_ = reinterpret_cast<BrowserThemePackHeader*>(const_cast<char*>(
400 pointer.data())); 400 pointer.data()));
401 401
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 hsl.h = tints_[i].h; 1085 hsl.h = tints_[i].h;
1086 hsl.s = tints_[i].s; 1086 hsl.s = tints_[i].s;
1087 hsl.l = tints_[i].l; 1087 hsl.l = tints_[i].l;
1088 return hsl; 1088 return hsl;
1089 } 1089 }
1090 } 1090 }
1091 } 1091 }
1092 1092
1093 return ThemeService::GetDefaultTint(id); 1093 return ThemeService::GetDefaultTint(id);
1094 } 1094 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_mac.mm ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698