diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 00:41:44 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 00:41:44 +0000 |
commit | 5b1a04b49b0b58b8268415118c89f3056cbd1fac (patch) | |
tree | a81fc292bcfc9c2b36b826dd6253d89a5339e06c | |
parent | 15c532e6a94646f9d5ed40af9bcb60a28a30a7ec (diff) | |
download | chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.zip chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.tar.gz chromium_src-5b1a04b49b0b58b8268415118c89f3056cbd1fac.tar.bz2 |
Allow platform apps to open links in the browser.
Triggered via <a href="..." target="_blank"> or window.open('...').
R=miket@chromium.org
BUG=130213
Review URL: https://chromiumcodereview.appspot.com/10534147
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142292 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/platform_app_browsertest.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/extensions/shell_window.cc | 72 | ||||
-rw-r--r-- | chrome/browser/ui/extensions/shell_window.h | 13 | ||||
-rw-r--r-- | chrome/common/extensions/extension_messages.h | 6 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_helper.cc | 40 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_helper.h | 8 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/open_link/link.html | 10 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/open_link/main.html | 11 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/open_link/main.js | 19 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/open_link/manifest.json | 14 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/open_link/test.js | 7 | ||||
-rw-r--r-- | content/common/devtools_messages.cc | 44 | ||||
-rw-r--r-- | content/common/devtools_messages.h | 19 | ||||
-rw-r--r-- | content/content_common.gypi | 1 | ||||
-rw-r--r-- | content/public/common/common_param_traits.cc | 35 | ||||
-rw-r--r-- | content/public/common/common_param_traits.h | 9 |
16 files changed, 248 insertions, 71 deletions
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 738b6f1..11982ae 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/shell_window_registry.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/extensions/shell_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/ui_test_utils.h" using content::WebContents; @@ -257,3 +258,13 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { } #endif // defined(OS_CHROMEOS) + +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { + ASSERT_TRUE(StartTestServer()); + ui_test_utils::WindowedNotificationObserver observer( + chrome::NOTIFICATION_TAB_ADDED, + content::Source<content::WebContentsDelegate>(browser())); + LoadAndLaunchPlatformApp("open_link"); + observer.Wait(); + ASSERT_EQ(2, browser()->tab_count()); +} diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc index 0a2701e..b092211 100644 --- a/chrome/browser/ui/extensions/shell_window.cc +++ b/chrome/browser/ui/extensions/shell_window.cc @@ -13,6 +13,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_id.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/intents/web_intent_picker_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/view_type_utils.h" @@ -31,6 +33,7 @@ #include "content/public/browser/web_intents_dispatcher.h" #include "content/public/common/renderer_preferences.h" +using content::ConsoleMessageLevel; using content::SiteInstance; using content::WebContents; @@ -130,6 +133,68 @@ void ShellWindow::RequestMediaAccessPermission( callback.Run(devices); } +WebContents* ShellWindow::OpenURLFromTab(WebContents* source, + const content::OpenURLParams& params) { + DCHECK(source == web_contents_); + + if (params.url.host() == extension_->id()) { + AddMessageToDevToolsConsole( + content::CONSOLE_MESSAGE_LEVEL_ERROR, + base::StringPrintf( + "Can't navigate to \"%s\"; apps do not support navigation.", + params.url.spec().c_str())); + return NULL; + } + + // Don't allow the current tab to be navigated. It would be nice to map all + // anchor tags (even those without target="_blank") to new tabs, but right + // now we can't distinguish between those and <meta> refreshes, which we + // don't want to allow. + // TOOD(mihaip): Can we check for user gestures instead? + WindowOpenDisposition disposition = params.disposition; + if (disposition == CURRENT_TAB) { + AddMessageToDevToolsConsole( + content::CONSOLE_MESSAGE_LEVEL_ERROR, + base::StringPrintf( + "Can't open same-window link to \"%s\"; try target=\"_blank\".", + params.url.spec().c_str())); + return NULL; + } + + // These dispositions aren't really navigations. + if (disposition == SUPPRESS_OPEN || disposition == SAVE_TO_DISK || + disposition == IGNORE_ACTION) { + return NULL; + } + + // Force all links to open in a new tab, even if they were trying to open a + // window. + content::OpenURLParams new_tab_params = params; + new_tab_params.disposition = + disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; + Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); + WebContents* new_tab = browser->OpenURL(new_tab_params); + browser->window()->Show(); + return new_tab; +} + +void ShellWindow::AddNewContents(WebContents* source, + WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { + DCHECK(source == web_contents_); + DCHECK(Profile::FromBrowserContext(new_contents->GetBrowserContext()) == + profile_); + Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); + // Force all links to open in a new tab, even if they were trying to open a + // new window. + disposition = + disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; + browser->AddWebContents( + new_contents, disposition, initial_pos, user_gesture); +} + void ShellWindow::OnNativeClose() { ShellWindowRegistry::Get(profile_)->RemoveShellWindow(this); delete this; @@ -237,3 +302,10 @@ void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { extension_function_dispatcher_.Dispatch(params, web_contents_->GetRenderViewHost()); } + +void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, + const std::string& message) { + content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); + rvh->Send(new ExtensionMsg_AddMessageToConsole( + rvh->GetRoutingID(), level, message)); +} diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h index ee0cdda..142ecfb 100644 --- a/chrome/browser/ui/extensions/shell_window.h +++ b/chrome/browser/ui/extensions/shell_window.h @@ -14,6 +14,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" +#include "content/public/common/console_message_level.h" #include "ui/gfx/rect.h" class ExtensionWindowController; @@ -118,6 +119,14 @@ class ShellWindow : public content::NotificationObserver, content::WebContents* web_contents, const content::MediaStreamRequest* request, const content::MediaResponseCallback& callback) OVERRIDE; + virtual content::WebContents* OpenURLFromTab( + content::WebContents* source, + const content::OpenURLParams& params) OVERRIDE; + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) OVERRIDE; // content::NotificationObserver implementation. virtual void Observe(int type, @@ -131,6 +140,10 @@ class ShellWindow : public content::NotificationObserver, // Message handlers. void OnRequest(const ExtensionHostMsg_Request_Params& params); + // Helper method to add a message to the renderer's DevTools console. + void AddMessageToDevToolsConsole(content::ConsoleMessageLevel level, + const std::string& message); + Profile* profile_; // weak pointer - owned by ProfileManager. // weak pointer - owned by ExtensionService. const extensions::Extension* extension_; diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index a79c9de..ae2b7f9 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -13,6 +13,7 @@ #include "chrome/common/extensions/url_pattern_set.h" #include "chrome/common/view_type.h" #include "chrome/common/web_apps.h" +#include "content/public/common/common_param_traits.h" #include "ipc/ipc_message_macros.h" #define IPC_MESSAGE_START ExtensionMsgStart @@ -325,6 +326,11 @@ IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect, IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel, int /* channel */) +// Adds a logging message to the renderer's root frame DevTools console. +IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole, + content::ConsoleMessageLevel /* level */, + std::string /* message */) + // Messages sent from the renderer to the browser. // A renderer sends this message when an extension process starts an API diff --git a/chrome/renderer/extensions/extension_helper.cc b/chrome/renderer/extensions/extension_helper.cc index a3460bf..24d3dc2 100644 --- a/chrome/renderer/extensions/extension_helper.cc +++ b/chrome/renderer/extensions/extension_helper.cc @@ -32,6 +32,7 @@ #include "webkit/glue/image_resource_fetcher.h" #include "webkit/glue/resource_fetcher.h" +using content::ConsoleMessageLevel; using extensions::MiscellaneousBindings; using WebKit::WebConsoleMessage; using WebKit::WebDataSource; @@ -215,6 +216,8 @@ bool ExtensionHelper::OnMessageReceived(const IPC::Message& message) { OnUpdateBrowserWindowId) IPC_MESSAGE_HANDLER(ExtensionMsg_NotifyRenderViewType, OnNotifyRendererViewType) + IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole, + OnAddMessageToConsole) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -385,6 +388,11 @@ void ExtensionHelper::OnUpdateBrowserWindowId(int window_id) { browser_window_id_ = window_id; } +void ExtensionHelper::OnAddMessageToConsole(ConsoleMessageLevel level, + const std::string& message) { + AddMessageToRootConsole(level, UTF8ToUTF16(message)); +} + void ExtensionHelper::DidDownloadApplicationDefinition( const WebKit::WebURLResponse& response, const std::string& data) { @@ -396,14 +404,16 @@ void ExtensionHelper::DidDownloadApplicationDefinition( std::string error_message; scoped_ptr<Value> result(serializer.Deserialize(&error_code, &error_message)); if (!result.get()) { - AddErrorToRootConsole(UTF8ToUTF16(error_message)); + AddMessageToRootConsole( + content::CONSOLE_MESSAGE_LEVEL_ERROR, UTF8ToUTF16(error_message)); return; } string16 error_message_16; if (!web_apps::ParseWebAppFromDefinitionFile(result.get(), app_info.get(), &error_message_16)) { - AddErrorToRootConsole(error_message_16); + AddMessageToRootConsole( + content::CONSOLE_MESSAGE_LEVEL_ERROR, error_message_16); return; } @@ -466,8 +476,10 @@ void ExtensionHelper::DidDownloadApplicationIcon(ImageResourceFetcher* fetcher, for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { size_t current_size = pending_app_info_->icons[i].data.getSize(); if (current_size > kMaxIconSize - actual_icon_size) { - AddErrorToRootConsole(ASCIIToUTF16( - "Icons are too large. Maximum total size for app icons is 128 KB.")); + AddMessageToRootConsole( + content::CONSOLE_MESSAGE_LEVEL_ERROR, + ASCIIToUTF16("Icons are too large. " + "Maximum total size for app icons is 128 KB.")); return; } actual_icon_size += current_size; @@ -478,9 +490,25 @@ void ExtensionHelper::DidDownloadApplicationIcon(ImageResourceFetcher* fetcher, pending_app_info_.reset(NULL); } -void ExtensionHelper::AddErrorToRootConsole(const string16& message) { +void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level, + const string16& message) { if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { + WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; + switch (level) { + case content::CONSOLE_MESSAGE_LEVEL_TIP: + target_level = WebConsoleMessage::LevelTip; + break; + case content::CONSOLE_MESSAGE_LEVEL_LOG: + target_level = WebConsoleMessage::LevelLog; + break; + case content::CONSOLE_MESSAGE_LEVEL_WARNING: + target_level = WebConsoleMessage::LevelWarning; + break; + case content::CONSOLE_MESSAGE_LEVEL_ERROR: + target_level = WebConsoleMessage::LevelError; + break; + } render_view()->GetWebView()->mainFrame()->addMessageToConsole( - WebConsoleMessage(WebConsoleMessage::LevelError, message)); + WebConsoleMessage(target_level, message)); } } diff --git a/chrome/renderer/extensions/extension_helper.h b/chrome/renderer/extensions/extension_helper.h index 99afbde..46a91aa 100644 --- a/chrome/renderer/extensions/extension_helper.h +++ b/chrome/renderer/extensions/extension_helper.h @@ -12,6 +12,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "chrome/common/view_type.h" +#include "content/public/common/console_message_level.h" #include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer_tracker.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" @@ -95,6 +96,8 @@ class ExtensionHelper void OnNotifyRendererViewType(chrome::ViewType view_type); void OnSetTabId(int tab_id); void OnUpdateBrowserWindowId(int window_id); + void OnAddMessageToConsole(content::ConsoleMessageLevel level, + const std::string& message); // Callback triggered when we finish downloading the application definition // file. @@ -106,8 +109,9 @@ class ExtensionHelper void DidDownloadApplicationIcon(webkit_glue::ImageResourceFetcher* fetcher, const SkBitmap& image); - // Helper to add an error message to the root frame's console. - void AddErrorToRootConsole(const string16& message); + // Helper to add an logging message to the root frame's console. + void AddMessageToRootConsole(content::ConsoleMessageLevel level, + const string16& message); ExtensionDispatcher* extension_dispatcher_; diff --git a/chrome/test/data/extensions/platform_apps/open_link/link.html b/chrome/test/data/extensions/platform_apps/open_link/link.html new file mode 100644 index 0000000..1665045 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/link.html @@ -0,0 +1,10 @@ +<!-- + * Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<body> +I am a remote link. +</body> +</html> diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.html b/chrome/test/data/extensions/platform_apps/open_link/main.html new file mode 100644 index 0000000..783d5f0 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/main.html @@ -0,0 +1,11 @@ +<!-- + * Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<body> +<a id="test-link" target="_blank">Click me</a> +<script src="main.js"></script> +</body> +</html> diff --git a/chrome/test/data/extensions/platform_apps/open_link/main.js b/chrome/test/data/extensions/platform_apps/open_link/main.js new file mode 100644 index 0000000..ddd0c8a --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/main.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.test.getConfig(function(config) { + var linkNode = document.getElementById('test-link'); + linkNode.href = 'http://localhost:' + config.testServer.port + + '/files/extensions/platform_apps/open_link/link.html'; + + var clickEvent = document.createEvent('MouseEvents'); + clickEvent.initMouseEvent('click', true, true, window, + 0, 0, 0, 0, 0, false, false, + false, false, 0, null); + linkNode.dispatchEvent(clickEvent); +}); + +onmessage = function() { + chrome.test.sendMessage('Link opened'); +}; diff --git a/chrome/test/data/extensions/platform_apps/open_link/manifest.json b/chrome/test/data/extensions/platform_apps/open_link/manifest.json new file mode 100644 index 0000000..fc44eb4 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/manifest.json @@ -0,0 +1,14 @@ +{ + "name": "Platform App Test: minimal platform app", + "version": "1", + "manifest_version": 2, + "permissions": [ + "experimental", + "appWindow" + ], + "app": { + "background": { + "scripts": ["test.js"] + } + } +} diff --git a/chrome/test/data/extensions/platform_apps/open_link/test.js b/chrome/test/data/extensions/platform_apps/open_link/test.js new file mode 100644 index 0000000..ce719f7 --- /dev/null +++ b/chrome/test/data/extensions/platform_apps/open_link/test.js @@ -0,0 +1,7 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.experimental.app.onLaunched.addListener(function() { + chrome.appWindow.create('main.html', {}, function () {}); +}); diff --git a/content/common/devtools_messages.cc b/content/common/devtools_messages.cc deleted file mode 100644 index bc61d4c..0000000 --- a/content/common/devtools_messages.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/devtools_messages.h" - -namespace IPC { - -void ParamTraits<content::ConsoleMessageLevel>::Write(Message* m, - const param_type& p) { - m->WriteInt(static_cast<int>(p)); -} - -bool ParamTraits<content::ConsoleMessageLevel>::Read(const Message* m, - PickleIterator* iter, - param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<param_type>(type); - return true; -} - -void ParamTraits<content::ConsoleMessageLevel>::Log(const param_type& p, - std::string* l) { - std::string level; - switch (p) { - case content::CONSOLE_MESSAGE_LEVEL_TIP: - level = "CONSOLE_MESSAGE_LEVEL_TIP"; - break; - case content::CONSOLE_MESSAGE_LEVEL_LOG: - level = "CONSOLE_MESSAGE_LEVEL_LOG"; - break; - case content::CONSOLE_MESSAGE_LEVEL_WARNING: - level = "CONSOLE_MESSAGE_LEVEL_WARNING"; - break; - case content::CONSOLE_MESSAGE_LEVEL_ERROR: - level = "CONSOLE_MESSAGE_LEVEL_ERROR"; - break; - } - LogParam(level, l); -} - -} // namespace IPC diff --git a/content/common/devtools_messages.h b/content/common/devtools_messages.h index 4f2d078..9acaf5d 100644 --- a/content/common/devtools_messages.h +++ b/content/common/devtools_messages.h @@ -43,6 +43,7 @@ #include <string> #include "content/common/content_export.h" +#include "content/public/common/common_param_traits.h" #include "content/public/common/console_message_level.h" #include "ipc/ipc_message_macros.h" @@ -51,24 +52,6 @@ #define IPC_MESSAGE_START DevToolsMsgStart -// Singly-included section since need custom serialization. -#ifndef CONTENT_COMMON_DEVTOOLS_MESSAGES_H_ -#define CONTENT_COMMON_DEVTOOLS_MESSAGES_H_ - -namespace IPC { - -template<> -struct ParamTraits<content::ConsoleMessageLevel> { - typedef content::ConsoleMessageLevel param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, PickleIterator* iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // CONTENT_COMMON_DEVTOOLS_MESSAGES_H_ - // These are messages sent from DevToolsAgent to DevToolsClient through the // browser. // WebKit-level transport. diff --git a/content/content_common.gypi b/content/content_common.gypi index 3785d4c..4a78a9d 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -140,7 +140,6 @@ 'common/debug_flags.h', 'common/desktop_notification_messages.h', 'common/device_orientation_messages.h', - 'common/devtools_messages.cc', 'common/devtools_messages.h', 'common/dom_storage_messages.h', 'common/drag_messages.h', diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc index 1ee5f7b..723c33b 100644 --- a/content/public/common/common_param_traits.cc +++ b/content/public/common/common_param_traits.cc @@ -553,4 +553,39 @@ void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { l->append("<SkBitmap>"); } +void ParamTraits<content::ConsoleMessageLevel>::Write(Message* m, + const param_type& p) { + m->WriteInt(static_cast<int>(p)); +} + +bool ParamTraits<content::ConsoleMessageLevel>::Read(const Message* m, + PickleIterator* iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<param_type>(type); + return true; +} + +void ParamTraits<content::ConsoleMessageLevel>::Log(const param_type& p, + std::string* l) { + std::string level; + switch (p) { + case content::CONSOLE_MESSAGE_LEVEL_TIP: + level = "CONSOLE_MESSAGE_LEVEL_TIP"; + break; + case content::CONSOLE_MESSAGE_LEVEL_LOG: + level = "CONSOLE_MESSAGE_LEVEL_LOG"; + break; + case content::CONSOLE_MESSAGE_LEVEL_WARNING: + level = "CONSOLE_MESSAGE_LEVEL_WARNING"; + break; + case content::CONSOLE_MESSAGE_LEVEL_ERROR: + level = "CONSOLE_MESSAGE_LEVEL_ERROR"; + break; + } + LogParam(level, l); +} + } // namespace IPC diff --git a/content/public/common/common_param_traits.h b/content/public/common/common_param_traits.h index 661028e..cf280be 100644 --- a/content/public/common/common_param_traits.h +++ b/content/public/common/common_param_traits.h @@ -17,6 +17,7 @@ #include "base/memory/ref_counted.h" #include "content/common/content_export.h" +#include "content/public/common/console_message_level.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/security_style.h" #include "googleurl/src/gurl.h" @@ -247,6 +248,14 @@ struct SimilarTypeTraits<content::SecurityStyle> { typedef int Type; }; +template<> +struct CONTENT_EXPORT ParamTraits<content::ConsoleMessageLevel> { + typedef content::ConsoleMessageLevel param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, PickleIterator* iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |