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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 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) 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/notification_service.h" 47 #include "content/public/browser/notification_service.h"
48 #include "content/public/browser/render_view_host.h" 48 #include "content/public/browser/render_view_host.h"
49 #include "content/public/browser/user_metrics.h" 49 #include "content/public/browser/user_metrics.h"
50 #include "content/public/browser/web_contents.h" 50 #include "content/public/browser/web_contents.h"
51 #include "content/public/browser/web_ui.h" 51 #include "content/public/browser/web_ui.h"
52 #include "grit/browser_resources.h" 52 #include "grit/browser_resources.h"
53 #include "grit/generated_resources.h" 53 #include "grit/generated_resources.h"
54 #include "grit/theme_resources.h" 54 #include "grit/theme_resources.h"
55 #include "ui/base/l10n/l10n_util.h" 55 #include "ui/base/l10n/l10n_util.h"
56 #include "ui/base/layout.h"
57 #include "ui/base/resource/resource_bundle.h"
56 58
57 #if !defined(OS_ANDROID) 59 #if !defined(OS_ANDROID)
58 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 60 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" 61 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
60 #endif 62 #endif
61 63
62 using content::BrowserThread; 64 using content::BrowserThread;
63 using content::RenderViewHost; 65 using content::RenderViewHost;
64 using content::UserMetricsAction; 66 using content::UserMetricsAction;
65 using content::WebContents; 67 using content::WebContents;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 bool is_incognito, 350 bool is_incognito,
349 int request_id) { 351 int request_id) {
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
351 353
352 std::map<std::string, std::pair<std::string, int> >::iterator it = 354 std::map<std::string, std::pair<std::string, int> >::iterator it =
353 resource_map_.find(path); 355 resource_map_.find(path);
354 if (it != resource_map_.end()) { 356 if (it != resource_map_.end()) {
355 scoped_refptr<base::RefCountedStaticMemory> resource_bytes( 357 scoped_refptr<base::RefCountedStaticMemory> resource_bytes(
356 it->second.second ? 358 it->second.second ?
357 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( 359 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
358 it->second.second) : 360 it->second.second, ui::SCALE_FACTOR_NONE) :
359 new base::RefCountedStaticMemory); 361 new base::RefCountedStaticMemory);
360 SendResponse(request_id, resource_bytes); 362 SendResponse(request_id, resource_bytes);
361 return; 363 return;
362 } 364 }
363 365
364 if (!path.empty() && path[0] != '#') { 366 if (!path.empty() && path[0] != '#') {
365 // A path under new-tab was requested; it's likely a bad relative 367 // A path under new-tab was requested; it's likely a bad relative
366 // URL from the new tab page, but in any case it's an error. 368 // URL from the new tab page, but in any case it's an error.
367 NOTREACHED() << path << " should not have been requested on the NTP"; 369 NOTREACHED() << path << " should not have been requested on the NTP";
368 return; 370 return;
(...skipping 20 matching lines...) Expand all
389 } 391 }
390 392
391 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 393 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
392 const char* mime_type, 394 const char* mime_type,
393 int resource_id) { 395 int resource_id) {
394 DCHECK(resource); 396 DCHECK(resource);
395 DCHECK(mime_type); 397 DCHECK(mime_type);
396 resource_map_[std::string(resource)] = 398 resource_map_[std::string(resource)] =
397 std::make_pair(std::string(mime_type), resource_id); 399 std::make_pair(std::string(mime_type), resource_id);
398 } 400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698