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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_about_handler.h" 5 #include "chrome/browser/browser_about_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 path == kStringsJsPath || 1433 path == kStringsJsPath ||
1434 path == kVersionJsPath || 1434 path == kVersionJsPath ||
1435 path == kMemoryJsPath) { 1435 path == kMemoryJsPath) {
1436 return "application/javascript"; 1436 return "application/javascript";
1437 } 1437 }
1438 return "text/html"; 1438 return "text/html";
1439 } 1439 }
1440 1440
1441 // ----------------------------------------------------------------------------- 1441 // -----------------------------------------------------------------------------
1442 1442
1443 void InitializeAboutDataSource(const std::string& name, Profile* profile) { 1443 void InitializeAboutDataSource(const std::string& name,
1444 content::BrowserContext* browser_context) {
1445 Profile* profile = static_cast<Profile*>(browser_context);
1444 ChromeURLDataManager* manager = profile->GetChromeURLDataManager(); 1446 ChromeURLDataManager* manager = profile->GetChromeURLDataManager();
1445 for (size_t i = 0; i < arraysize(kAboutSourceNames); i++) { 1447 for (size_t i = 0; i < arraysize(kAboutSourceNames); i++) {
1446 if (name == kAboutSourceNames[i]) { 1448 if (name == kAboutSourceNames[i]) {
1447 manager->AddDataSource(new AboutSource(name, profile)); 1449 manager->AddDataSource(new AboutSource(name, profile));
1448 return; 1450 return;
1449 } 1451 }
1450 } 1452 }
1451 } 1453 }
1452 1454
1453 bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) { 1455 bool WillHandleBrowserAboutURL(GURL* url,
1456 content::BrowserContext* browser_context) {
1454 // TODO(msw): Eliminate "about:*" constants and literals from code and tests, 1457 // TODO(msw): Eliminate "about:*" constants and literals from code and tests,
1455 // then hopefully we can remove this forced fixup. 1458 // then hopefully we can remove this forced fixup.
1456 *url = URLFixerUpper::FixupURL(url->possibly_invalid_spec(), std::string()); 1459 *url = URLFixerUpper::FixupURL(url->possibly_invalid_spec(), std::string());
1457 1460
1458 // Check that about: URLs are fixed up to chrome: by URLFixerUpper::FixupURL. 1461 // Check that about: URLs are fixed up to chrome: by URLFixerUpper::FixupURL.
1459 DCHECK((*url == GURL(chrome::kAboutBlankURL)) || 1462 DCHECK((*url == GURL(chrome::kAboutBlankURL)) ||
1460 !url->SchemeIs(chrome::kAboutScheme)); 1463 !url->SchemeIs(chrome::kAboutScheme));
1461 1464
1462 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. 1465 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo.
1463 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access. 1466 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access.
(...skipping 30 matching lines...) Expand all
1494 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); 1497 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean());
1495 } else if (host == chrome::kChromeUIGpuCrashHost) { 1498 } else if (host == chrome::kChromeUIGpuCrashHost) {
1496 GpuProcessHost::SendOnIO( 1499 GpuProcessHost::SendOnIO(
1497 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash()); 1500 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUCRASH, new GpuMsg_Crash());
1498 } else if (host == chrome::kChromeUIGpuHangHost) { 1501 } else if (host == chrome::kChromeUIGpuHangHost) {
1499 GpuProcessHost::SendOnIO( 1502 GpuProcessHost::SendOnIO(
1500 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang()); 1503 0, content::CAUSE_FOR_GPU_LAUNCH_ABOUT_GPUHANG, new GpuMsg_Hang());
1501 } 1504 }
1502 1505
1503 // Initialize any potentially corresponding AboutSource handler. 1506 // Initialize any potentially corresponding AboutSource handler.
1504 InitializeAboutDataSource(host, profile); 1507 InitializeAboutDataSource(host, browser_context);
1505 return true; 1508 return true;
1506 } 1509 }
1507 1510
1508 bool HandleNonNavigationAboutURL(const GURL& url) { 1511 bool HandleNonNavigationAboutURL(const GURL& url) {
1509 // chrome://ipc/ is currently buggy, so we disable it for official builds. 1512 // chrome://ipc/ is currently buggy, so we disable it for official builds.
1510 #if !defined(OFFICIAL_BUILD) 1513 #if !defined(OFFICIAL_BUILD)
1511 1514
1512 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED) 1515 #if (defined(OS_MACOSX) || defined(OS_WIN)) && defined(IPC_MESSAGE_LOG_ENABLED)
1513 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) { 1516 if (LowerCaseEqualsASCII(url.spec(), chrome::kChromeUIIPCURL)) {
1514 // Run the dialog. This will re-use the existing one if it's already up. 1517 // Run the dialog. This will re-use the existing one if it's already up.
1515 browser::ShowAboutIPCDialog(); 1518 browser::ShowAboutIPCDialog();
1516 return true; 1519 return true;
1517 } 1520 }
1518 #endif 1521 #endif
1519 1522
1520 #endif // OFFICIAL_BUILD 1523 #endif // OFFICIAL_BUILD
1521 1524
1522 return false; 1525 return false;
1523 } 1526 }
1524 1527
1525 std::vector<std::string> ChromePaths() { 1528 std::vector<std::string> ChromePaths() {
1526 std::vector<std::string> paths; 1529 std::vector<std::string> paths;
1527 paths.reserve(arraysize(kChromePaths)); 1530 paths.reserve(arraysize(kChromePaths));
1528 for (size_t i = 0; i < arraysize(kChromePaths); i++) 1531 for (size_t i = 0; i < arraysize(kChromePaths); i++)
1529 paths.push_back(kChromePaths[i]); 1532 paths.push_back(kChromePaths[i]);
1530 return paths; 1533 return paths;
1531 } 1534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698