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

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

Issue 10272004: Move RefCountedMemory class to base namespace. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 return; 402 return;
403 } 403 }
404 404
405 if (!path.empty() && path[0] != '#') { 405 if (!path.empty() && path[0] != '#') {
406 // A path under new-tab was requested; it's likely a bad relative 406 // A path under new-tab was requested; it's likely a bad relative
407 // URL from the new tab page, but in any case it's an error. 407 // URL from the new tab page, but in any case it's an error.
408 NOTREACHED() << path << " should not have been requested on the NTP"; 408 NOTREACHED() << path << " should not have been requested on the NTP";
409 return; 409 return;
410 } 410 }
411 411
412 scoped_refptr<RefCountedMemory> html_bytes( 412 scoped_refptr<base::RefCountedMemory> html_bytes(
413 NTPResourceCacheFactory::GetForProfile(profile_)-> 413 NTPResourceCacheFactory::GetForProfile(profile_)->
414 GetNewTabHTML(is_incognito)); 414 GetNewTabHTML(is_incognito));
415 415
416 SendResponse(request_id, html_bytes); 416 SendResponse(request_id, html_bytes);
417 } 417 }
418 418
419 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string& resource) 419 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string& resource)
420 const { 420 const {
421 std::map<std::string, std::pair<std::string, int> >::const_iterator it = 421 std::map<std::string, std::pair<std::string, int> >::const_iterator it =
422 resource_map_.find(resource); 422 resource_map_.find(resource);
423 if (it != resource_map_.end()) 423 if (it != resource_map_.end())
424 return it->second.first; 424 return it->second.first;
425 return "text/html"; 425 return "text/html";
426 } 426 }
427 427
428 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const { 428 bool NewTabUI::NewTabHTMLSource::ShouldReplaceExistingSource() const {
429 return false; 429 return false;
430 } 430 }
431 431
432 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 432 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
433 const char* mime_type, 433 const char* mime_type,
434 int resource_id) { 434 int resource_id) {
435 DCHECK(resource); 435 DCHECK(resource);
436 DCHECK(mime_type); 436 DCHECK(mime_type);
437 resource_map_[std::string(resource)] = 437 resource_map_[std::string(resource)] =
438 std::make_pair(std::string(mime_type), resource_id); 438 std::make_pair(std::string(mime_type), resource_id);
439 } 439 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/favicon_webui_handler.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698