Commit 24f8069f authored by jam@chromium.org's avatar jam@chromium.org

Add local file system directory listings support for content shell.

Also remove the per-platform PlatformResourceProvider function.

Based on http://codereview.chromium.org/10826242/ by shouqun.liu@intel.com

BUG=90445
Review URL: https://chromiumcodereview.appspot.com/10830260

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151267 0039d316-1c4b-4281-b951-d872f2087c98
parent f545860a
......@@ -32,11 +32,12 @@
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:media',
'../net/net.gyp:net',
'../net/net.gyp:net_resources',
'../skia/skia.gyp:skia',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
'../ui/ui.gyp:ui',
'../v8/tools/gyp/v8.gyp:v8',
'../webkit/support/webkit_support.gyp:webkit_support',
'<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
],
'include_dirs': [
'..',
......@@ -239,7 +240,6 @@
'dependencies': [
'browser/debugger/devtools_resources.gyp:devtools_resources',
'content_shell_resources',
'<(DEPTH)/net/net.gyp:net_resources',
'<(DEPTH)/ui/ui.gyp:ui_resources',
],
'variables': {
......
......@@ -13,6 +13,7 @@ include_rules = [
"+ui/base/resource",
# Shell resources
"+grit/net_resources.h",
"+grit/shell_resources.h",
# The content_shell for aura must work with the views and aura
......
......@@ -63,9 +63,6 @@ class Shell : public WebContentsDelegate,
// Do one time initialization at application startup.
static void PlatformInitialize();
// This is called indirectly by the modules that need access resources.
static base::StringPiece PlatformResourceProvider(int key);
static Shell* CreateNewWindow(BrowserContext* browser_context,
const GURL& url,
SiteInstance* site_instance,
......
......@@ -20,10 +20,6 @@ using base::android::ConvertUTF8ToJavaString;
namespace content {
base::StringPiece Shell::PlatformResourceProvider(int key) {
return base::StringPiece();
}
void Shell::PlatformInitialize() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
DCHECK(command_line->HasSwitch(switches::kForceCompositingMode));
......
......@@ -340,10 +340,6 @@ void Shell::PlatformInitialize() {
views_delegate_ = new ShellViewsDelegateAura();
}
base::StringPiece Shell::PlatformResourceProvider(int key) {
return base::StringPiece();
}
void Shell::PlatformExit() {
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Shutdown();
......
......@@ -17,7 +17,9 @@
#include "content/shell/shell_devtools_delegate.h"
#include "content/shell/shell_switches.h"
#include "googleurl/src/gurl.h"
#include "grit/net_resources.h"
#include "net/base/net_module.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(OS_ANDROID)
#include "net/base/network_change_notifier.h"
......@@ -26,6 +28,8 @@
namespace content {
namespace {
static GURL GetStartupURL() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kContentBrowserTest))
......@@ -43,6 +47,18 @@ static GURL GetStartupURL() {
return GURL(args[0]);
}
base::StringPiece PlatformResourceProvider(int key) {
if (key == IDR_DIR_HEADER_HTML) {
base::StringPiece html_data =
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_DIR_HEADER_HTML, ui::SCALE_FACTOR_NONE);
return html_data;
}
return base::StringPiece();
}
} // namespace
ShellBrowserMainParts::ShellBrowserMainParts(
const MainFunctionParams& parameters)
: BrowserMainParts(),
......@@ -77,7 +93,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
off_the_record_browser_context_.reset(new ShellBrowserContext(true));
Shell::PlatformInitialize();
net::NetModule::SetResourceProvider(Shell::PlatformResourceProvider);
net::NetModule::SetResourceProvider(PlatformResourceProvider);
devtools_delegate_ = new ShellDevToolsDelegate(
browser_context_->GetRequestContext());
......
......@@ -60,11 +60,6 @@ GtkWidget* CreateMenuBar(Shell* shell) {
void Shell::PlatformInitialize() {
}
base::StringPiece Shell::PlatformResourceProvider(int key) {
NOTIMPLEMENTED();
return base::StringPiece();
}
void Shell::PlatformCleanUp() {
// Nothing to clean up; GTK will clean up the widgets shortly after.
}
......
......@@ -142,10 +142,6 @@ namespace content {
void Shell::PlatformInitialize() {
}
base::StringPiece Shell::PlatformResourceProvider(int key) {
return base::StringPiece();
}
void Shell::PlatformCleanUp() {
}
......@@ -190,9 +186,9 @@ void Shell::PlatformCreateWindow(int width, int height) {
}
CrShellWindow* window =
[[CrShellWindow alloc] initWithContentRect:content_rect
styleMask:style_mask
backing:NSBackingStoreBuffered
defer:NO];
styleMask:style_mask
backing:NSBackingStoreBuffered
defer:NO];
window_ = window;
[window setShell:this];
[window_ setTitle:kWindowTitle];
......
......@@ -10,19 +10,12 @@
#include <windows.h>
#include "base/command_line.h"
#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
#include "base/win/resource_util.h"
#include "base/win/wrapped_window_proc.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/shell/resource.h"
#include "content/shell/shell_switches.h"
#include "googleurl/src/gurl.h"
#include "grit/webkit_resources.h"
#include "grit/webkit_chromium_resources.h"
#include "ipc/ipc_message.h"
#include "net/base/net_module.h"
#include "ui/base/win/hwnd_util.h"
namespace {
......@@ -35,15 +28,6 @@ const int kURLBarHeight = 24;
const int kMaxURLLength = 1024;
static base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
void* data_ptr;
size_t data_size;
return base::win::GetDataResourceFromModule(module, resource_id, &data_ptr,
&data_size)
? base::StringPiece(static_cast<char*>(data_ptr), data_size)
: base::StringPiece();
}
} // namespace
namespace content {
......@@ -60,10 +44,6 @@ void Shell::PlatformInitialize() {
RegisterWindowClass();
}
base::StringPiece Shell::PlatformResourceProvider(int key) {
return GetRawDataResource(::GetModuleHandle(NULL), key);
}
void Shell::PlatformExit() {
std::vector<Shell*> windows = windows_;
for (std::vector<Shell*>::iterator it = windows.begin();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment