OLD | NEW |
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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 chrome::kChromeUIDiscardsURL, | 529 chrome::kChromeUIDiscardsURL, |
530 kAboutDiscardsRunCommand, it->tab_contents_id); | 530 kAboutDiscardsRunCommand, it->tab_contents_id); |
531 } | 531 } |
532 titles.push_back(str); | 532 titles.push_back(str); |
533 } | 533 } |
534 return titles; | 534 return titles; |
535 } | 535 } |
536 | 536 |
537 std::string AboutDiscards(const std::string& path) { | 537 std::string AboutDiscards(const std::string& path) { |
538 std::string output; | 538 std::string output; |
539 std::vector<std::string> path_split; | |
540 int64 web_content_id; | 539 int64 web_content_id; |
541 memory::OomPriorityManager* oom = g_browser_process->GetOomPriorityManager(); | 540 memory::OomPriorityManager* oom = g_browser_process->GetOomPriorityManager(); |
542 | 541 |
543 base::SplitString(path, '/', &path_split); | 542 std::vector<std::string> path_split = base::SplitString( |
| 543 path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
544 if (path_split.size() == 2 && path_split[0] == kAboutDiscardsRunCommand && | 544 if (path_split.size() == 2 && path_split[0] == kAboutDiscardsRunCommand && |
545 base::StringToInt64(path_split[1], &web_content_id)) { | 545 base::StringToInt64(path_split[1], &web_content_id)) { |
546 oom->DiscardTabById(web_content_id); | 546 oom->DiscardTabById(web_content_id); |
547 return BuildAboutDiscardsRunPage(); | 547 return BuildAboutDiscardsRunPage(); |
548 } else if (path_split.size() == 1 && | 548 } else if (path_split.size() == 1 && |
549 path_split[0] == kAboutDiscardsRunCommand) { | 549 path_split[0] == kAboutDiscardsRunCommand) { |
550 oom->DiscardTab(); | 550 oom->DiscardTab(); |
551 return BuildAboutDiscardsRunPage(); | 551 return BuildAboutDiscardsRunPage(); |
552 } | 552 } |
553 | 553 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 Profile* profile = Profile::FromWebUI(web_ui); | 1028 Profile* profile = Profile::FromWebUI(web_ui); |
1029 | 1029 |
1030 #if defined(ENABLE_THEMES) | 1030 #if defined(ENABLE_THEMES) |
1031 // Set up the chrome://theme/ source. | 1031 // Set up the chrome://theme/ source. |
1032 ThemeSource* theme = new ThemeSource(profile); | 1032 ThemeSource* theme = new ThemeSource(profile); |
1033 content::URLDataSource::Add(profile, theme); | 1033 content::URLDataSource::Add(profile, theme); |
1034 #endif | 1034 #endif |
1035 | 1035 |
1036 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 1036 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
1037 } | 1037 } |
OLD | NEW |