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

Side by Side Diff: chrome/browser/ui/webui/about_ui.cc

Issue 11962031: Move a few non-common css files out of chrome\browser\resources\shared\css. This is in anticipation… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | « chrome/browser/resources/shared_resources.grd ('k') | chrome/browser/ui/webui/version_ui.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) 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/ui/webui/about_ui.h" 5 #include "chrome/browser/ui/webui/about_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 using base::Time; 86 using base::Time;
87 using base::TimeDelta; 87 using base::TimeDelta;
88 using content::BrowserThread; 88 using content::BrowserThread;
89 using content::WebContents; 89 using content::WebContents;
90 90
91 namespace { 91 namespace {
92 92
93 const char kCreditsJsPath[] = "credits.js"; 93 const char kCreditsJsPath[] = "credits.js";
94 const char kMemoryJsPath[] = "memory.js"; 94 const char kMemoryJsPath[] = "memory.js";
95 const char kMemoryCssPath[] = "about_memory.css";
95 const char kStatsJsPath[] = "stats.js"; 96 const char kStatsJsPath[] = "stats.js";
96 const char kStringsJsPath[] = "strings.js"; 97 const char kStringsJsPath[] = "strings.js";
97 98
98 // When you type about:memory, it actually loads this intermediate URL that 99 // When you type about:memory, it actually loads this intermediate URL that
99 // redirects you to the final page. This avoids the problem where typing 100 // redirects you to the final page. This avoids the problem where typing
100 // "about:memory" on the new tab page or any other page where a process 101 // "about:memory" on the new tab page or any other page where a process
101 // transition would occur to the about URL will cause some confusion. 102 // transition would occur to the about URL will cause some confusion.
102 // 103 //
103 // The problem is that during the processing of the memory page, there are two 104 // The problem is that during the processing of the memory page, there are two
104 // processes active, the original and the destination one. This can create the 105 // processes active, the original and the destination one. This can create the
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 void FinishMemoryDataRequest( 552 void FinishMemoryDataRequest(
552 const std::string& path, 553 const std::string& path,
553 const content::URLDataSource::GotDataCallback& callback) { 554 const content::URLDataSource::GotDataCallback& callback) {
554 if (path == kStringsJsPath) { 555 if (path == kStringsJsPath) {
555 // The AboutMemoryHandler cleans itself up, but |StartFetch()| will want 556 // The AboutMemoryHandler cleans itself up, but |StartFetch()| will want
556 // the refcount to be greater than 0. 557 // the refcount to be greater than 0.
557 scoped_refptr<AboutMemoryHandler> handler(new AboutMemoryHandler(callback)); 558 scoped_refptr<AboutMemoryHandler> handler(new AboutMemoryHandler(callback));
558 // TODO(jamescook): Maybe this shouldn't update UMA? 559 // TODO(jamescook): Maybe this shouldn't update UMA?
559 handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS); 560 handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS);
560 } else { 561 } else {
561 std::string result = ResourceBundle::GetSharedInstance().GetRawDataResource( 562 int id = IDR_ABOUT_MEMORY_HTML;
562 path == kMemoryJsPath ? IDR_ABOUT_MEMORY_JS : IDR_ABOUT_MEMORY_HTML). 563 if (path == kMemoryJsPath) {
563 as_string(); 564 id = IDR_ABOUT_MEMORY_JS;
565 } else if (path == kMemoryCssPath) {
566 id = IDR_ABOUT_MEMORY_CSS;
567 }
568
569 std::string result =
570 ResourceBundle::GetSharedInstance().GetRawDataResource(id).as_string();
564 callback.Run(base::RefCountedString::TakeString(&result)); 571 callback.Run(base::RefCountedString::TakeString(&result));
565 } 572 }
566 } 573 }
567 574
568 // Handler for filling in the "about:stats" page, as called by the browser's 575 // Handler for filling in the "about:stats" page, as called by the browser's
569 // About handler processing. 576 // About handler processing.
570 // |query| is roughly the query string of the about:stats URL. 577 // |query| is roughly the query string of the about:stats URL.
571 // Returns a string containing the HTML to render for the about:stats page. 578 // Returns a string containing the HTML to render for the about:stats page.
572 // Conditional Output: 579 // Conditional Output:
573 // if |query| is "json", returns a JSON format of all counters. 580 // if |query| is "json", returns a JSON format of all counters.
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1041
1035 #if defined(ENABLE_THEMES) 1042 #if defined(ENABLE_THEMES)
1036 // Set up the chrome://theme/ source. 1043 // Set up the chrome://theme/ source.
1037 ThemeSource* theme = new ThemeSource(profile); 1044 ThemeSource* theme = new ThemeSource(profile);
1038 ChromeURLDataManager::AddDataSource(profile, theme); 1045 ChromeURLDataManager::AddDataSource(profile, theme);
1039 #endif 1046 #endif
1040 1047
1041 ChromeURLDataManager::AddDataSource( 1048 ChromeURLDataManager::AddDataSource(
1042 profile, new AboutUIHTMLSource(name, profile)); 1049 profile, new AboutUIHTMLSource(name, profile));
1043 } 1050 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/shared_resources.grd ('k') | chrome/browser/ui/webui/version_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698