diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 15:15:50 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 15:15:50 +0000 |
commit | 24f8069fb2f7c1624bbab9b4646c13352d26ad57 (patch) | |
tree | 5e254e6bf3bbeeaa845811b060ae8cdd0d7d7ac6 /content | |
parent | f545860aa5096811c927987e9b4b74cb558a9387 (diff) | |
download | chromium_src-24f8069fb2f7c1624bbab9b4646c13352d26ad57.zip chromium_src-24f8069fb2f7c1624bbab9b4646c13352d26ad57.tar.gz chromium_src-24f8069fb2f7c1624bbab9b4646c13352d26ad57.tar.bz2 |
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
Diffstat (limited to 'content')
-rw-r--r-- | content/content_shell.gypi | 4 | ||||
-rw-r--r-- | content/shell/DEPS | 1 | ||||
-rw-r--r-- | content/shell/shell.h | 3 | ||||
-rw-r--r-- | content/shell/shell_android.cc | 4 | ||||
-rw-r--r-- | content/shell/shell_aura.cc | 4 | ||||
-rw-r--r-- | content/shell/shell_browser_main_parts.cc | 18 | ||||
-rw-r--r-- | content/shell/shell_gtk.cc | 5 | ||||
-rw-r--r-- | content/shell/shell_mac.mm | 10 | ||||
-rw-r--r-- | content/shell/shell_win.cc | 20 |
9 files changed, 23 insertions, 46 deletions
diff --git a/content/content_shell.gypi b/content/content_shell.gypi index e97e802..2fe401d 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -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': { diff --git a/content/shell/DEPS b/content/shell/DEPS index 99f80b46..82e5b11 100644 --- a/content/shell/DEPS +++ b/content/shell/DEPS @@ -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 diff --git a/content/shell/shell.h b/content/shell/shell.h index 2332c45..ad81610 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -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, diff --git a/content/shell/shell_android.cc b/content/shell/shell_android.cc index cbf0b13..db407f6 100644 --- a/content/shell/shell_android.cc +++ b/content/shell/shell_android.cc @@ -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)); diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc index 9398dce..9a0cf9f 100644 --- a/content/shell/shell_aura.cc +++ b/content/shell/shell_aura.cc @@ -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(); diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc index 02ca51e..dabd00f 100644 --- a/content/shell/shell_browser_main_parts.cc +++ b/content/shell/shell_browser_main_parts.cc @@ -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()); diff --git a/content/shell/shell_gtk.cc b/content/shell/shell_gtk.cc index a09b639..cc181a2 100644 --- a/content/shell/shell_gtk.cc +++ b/content/shell/shell_gtk.cc @@ -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. } diff --git a/content/shell/shell_mac.mm b/content/shell/shell_mac.mm index 5edc873..065bf9c 100644 --- a/content/shell/shell_mac.mm +++ b/content/shell/shell_mac.mm @@ -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]; diff --git a/content/shell/shell_win.cc b/content/shell/shell_win.cc index 6998ccd..125887e 100644 --- a/content/shell/shell_win.cc +++ b/content/shell/shell_win.cc @@ -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(); |