summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_child_process_host.cc4
-rw-r--r--content/browser/browser_message_filter.cc2
-rw-r--r--content/browser/child_process_launcher.cc4
-rw-r--r--content/browser/child_process_security_policy_browsertest.cc2
-rw-r--r--content/browser/in_process_webkit/indexed_db_dispatcher_host.cc2
-rw-r--r--content/browser/renderer_host/database_message_filter.cc2
-rw-r--r--content/browser/renderer_host/render_sandbox_host_linux.cc2
-rw-r--r--content/browser/renderer_host/render_view_host.cc4
-rw-r--r--content/browser/renderer_host/render_view_host.h2
-rw-r--r--content/browser/renderer_host/render_view_host_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host.cc4
-rw-r--r--content/browser/renderer_host/render_widget_host.h2
-rw-r--r--content/browser/renderer_host/test_render_view_host.h2
-rw-r--r--content/browser/tab_contents/interstitial_page.cc2
-rw-r--r--content/browser/tab_contents/navigation_controller.cc2
-rw-r--r--content/browser/tab_contents/navigation_controller.h4
-rw-r--r--content/browser/tab_contents/navigation_entry.h4
-rw-r--r--content/browser/tab_contents/page_navigator.h2
-rw-r--r--content/browser/tab_contents/provisional_load_details.h2
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc2
-rw-r--r--content/browser/tab_contents/tab_contents.cc2
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--content/browser/tab_contents/test_tab_contents.cc2
-rw-r--r--content/browser/webui/web_ui.h2
-rw-r--r--content/browser/worker_host/worker_process_host.cc2
-rw-r--r--content/browser/zygote_host_linux.cc4
-rw-r--r--content/browser/zygote_main_linux.cc8
-rw-r--r--content/common/common.sb36
-rw-r--r--content/common/native_web_keyboard_event.h71
-rw-r--r--content/common/native_web_keyboard_event_linux.cc81
-rw-r--r--content/common/native_web_keyboard_event_mac.mm56
-rw-r--r--content/common/native_web_keyboard_event_win.cc54
-rw-r--r--content/common/navigation_gesture.h20
-rw-r--r--content/common/navigation_types.h67
-rw-r--r--content/common/page_transition_types.cc36
-rw-r--r--content/common/page_transition_types.h165
-rw-r--r--content/common/page_type.h17
-rw-r--r--content/common/page_zoom.h25
-rw-r--r--content/common/process_watcher.h45
-rw-r--r--content/common/process_watcher_mac.cc170
-rw-r--r--content/common/process_watcher_posix.cc105
-rw-r--r--content/common/process_watcher_unittest.cc65
-rw-r--r--content/common/process_watcher_win.cc84
-rw-r--r--content/common/result_codes.h67
-rw-r--r--content/common/sandbox_methods_linux.h25
-rw-r--r--content/common/set_process_title.cc81
-rw-r--r--content/common/set_process_title.h24
-rw-r--r--content/common/set_process_title_linux.cc115
-rw-r--r--content/common/set_process_title_linux.h23
-rw-r--r--content/content_common.gypi34
50 files changed, 1504 insertions, 38 deletions
diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc
index 5bc4265..4c3e816 100644
--- a/content/browser/browser_child_process_host.cc
+++ b/content/browser/browser_child_process_host.cc
@@ -18,13 +18,13 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/process_watcher.h"
-#include "chrome/common/result_codes.h"
#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/resource_message_filter.h"
#include "content/common/notification_service.h"
#include "content/common/plugin_messages.h"
+#include "content/common/process_watcher.h"
+#include "content/common/result_codes.h"
#if defined(OS_LINUX)
#include "base/linux_util.h"
diff --git a/content/browser/browser_message_filter.cc b/content/browser/browser_message_filter.cc
index e116153..eaf6d0d 100644
--- a/content/browser/browser_message_filter.cc
+++ b/content/browser/browser_message_filter.cc
@@ -8,7 +8,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "chrome/browser/metrics/user_metrics.h"
-#include "chrome/common/result_codes.h"
+#include "content/common/result_codes.h"
BrowserMessageFilter::BrowserMessageFilter()
: channel_(NULL), peer_handle_(base::kNullProcessHandle) {
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 9de4ccf..0cf79c2f 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -13,9 +13,9 @@
#include "base/threading/thread.h"
#include "chrome/common/chrome_descriptors.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/process_watcher.h"
-#include "chrome/common/result_codes.h"
#include "content/browser/browser_thread.h"
+#include "content/common/process_watcher.h"
+#include "content/common/result_codes.h"
#if defined(OS_WIN)
#include "base/file_path.h"
diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc
index f28001d..14d4b80 100644
--- a/content/browser/child_process_security_policy_browsertest.cc
+++ b/content/browser/child_process_security_policy_browsertest.cc
@@ -8,12 +8,12 @@
#include "base/file_path.h"
#include "base/process_util.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/common/result_codes.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
#include "content/browser/child_process_security_policy.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/result_codes.h"
#include "testing/gtest/include/gtest/gtest.h"
class ChildProcessSecurityPolicyInProcessBrowserTest
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index 7581c4d7..deb89d9 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -18,7 +18,7 @@
#include "content/browser/renderer_host/render_message_filter.h"
#include "content/browser/renderer_host/render_view_host_notification_task.h"
#include "content/common/indexed_db_messages.h"
-#include "chrome/common/result_codes.h"
+#include "content/common/result_codes.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc
index de2e903..8b42c23 100644
--- a/content/browser/renderer_host/database_message_filter.cc
+++ b/content/browser/renderer_host/database_message_filter.cc
@@ -11,8 +11,8 @@
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/chrome_url_request_context.h"
-#include "chrome/common/result_codes.h"
#include "content/common/database_messages.h"
+#include "content/common/result_codes.h"
#include "googleurl/src/gurl.h"
#include "third_party/sqlite/sqlite3.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc
index 3fca5127..ee944c2 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -26,8 +26,8 @@
#include "base/singleton.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "chrome/common/sandbox_methods_linux.h"
#include "content/common/font_config_ipc_linux.h"
+#include "content/common/sandbox_methods_linux.h"
#include "content/common/unix_domain_socket_posix.h"
#include "skia/ext/SkFontHost_fontconfig_direct.h"
#include "third_party/npapi/bindings/npapi_extensions.h"
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 6735ad7..3e0858f 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -24,11 +24,9 @@
#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "chrome/common/result_codes.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/translate_errors.h"
#include "chrome/common/url_constants.h"
@@ -41,9 +39,11 @@
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/site_instance.h"
+#include "content/common/native_web_keyboard_event.h"
#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "content/common/notification_type.h"
+#include "content/common/result_codes.h"
#include "net/base/net_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h"
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index f32062b..d0a0aa9 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -13,12 +13,12 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/page_zoom.h"
#include "chrome/common/render_view_commands.h"
#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "chrome/common/window_container_type.h"
#include "content/browser/renderer_host/render_widget_host.h"
+#include "content/common/page_zoom.h"
#include "net/base/load_states.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc
index 83c52fd7..4cdd3da 100644
--- a/content/browser/renderer_host/render_view_host_unittest.cc
+++ b/content/browser/renderer_host/render_view_host_unittest.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/page_transition_types.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/test_tab_contents.h"
+#include "content/common/page_transition_types.h"
class RenderViewHostTest : public RenderViewHostTestHarness {
};
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index ae3e0d1..819a56c 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -11,16 +11,16 @@
#include "chrome/browser/accessibility/browser_accessibility_state.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "chrome/common/result_codes.h"
#include "content/browser/renderer_host/backing_store.h"
#include "content/browser/renderer_host/backing_store_manager.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_widget_helper.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
+#include "content/common/native_web_keyboard_event.h"
#include "content/common/notification_service.h"
+#include "content/common/result_codes.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "webkit/glue/webcursor.h"
diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h
index 8be90128..61021c1 100644
--- a/content/browser/renderer_host/render_widget_host.h
+++ b/content/browser/renderer_host/render_widget_host.h
@@ -17,7 +17,7 @@
#include "base/string16.h"
#include "base/timer.h"
#include "chrome/common/edit_command.h"
-#include "chrome/common/native_web_keyboard_event.h"
+#include "content/common/native_web_keyboard_event.h"
#include "content/common/property_bag.h"
#include "ipc/ipc_channel.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h
index 6e70731..01bd215 100644
--- a/content/browser/renderer_host/test_render_view_host.h
+++ b/content/browser/renderer_host/test_render_view_host.h
@@ -11,11 +11,11 @@
#include "base/message_loop.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_content_browser_client.h"
-#include "chrome/common/page_transition_types.h"
#include "content/browser/renderer_host/mock_render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
+#include "content/common/page_transition_types.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gfx {
diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc
index cedc485..59d5886 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/net/url_request_context_getter.h"
-#include "chrome/common/page_transition_types.h"
#include "chrome/common/render_messages_params.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
@@ -33,6 +32,7 @@
#include "content/common/dom_storage_common.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
+#include "content/common/page_transition_types.h"
#include "net/base/escape.h"
#if defined(TOOLKIT_GTK)
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index e30ac46..3c853dc 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/navigation_types.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/url_constants.h"
@@ -25,6 +24,7 @@
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
+#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "grit/app_resources.h"
#include "net/base/escape.h"
diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h
index 8cc5267..86abd99 100644
--- a/content/browser/tab_contents/navigation_controller.h
+++ b/content/browser/tab_contents/navigation_controller.h
@@ -16,8 +16,8 @@
#include "googleurl/src/gurl.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/ssl/ssl_manager.h"
-#include "chrome/common/navigation_types.h"
-#include "chrome/common/page_transition_types.h"
+#include "content/common/navigation_types.h"
+#include "content/common/page_transition_types.h"
class NavigationEntry;
class Profile;
diff --git a/content/browser/tab_contents/navigation_entry.h b/content/browser/tab_contents/navigation_entry.h
index 84db5ef2..a9297b1 100644
--- a/content/browser/tab_contents/navigation_entry.h
+++ b/content/browser/tab_contents/navigation_entry.h
@@ -10,9 +10,9 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
-#include "chrome/common/page_type.h"
-#include "chrome/common/page_transition_types.h"
#include "chrome/common/security_style.h"
+#include "content/common/page_transition_types.h"
+#include "content/common/page_type.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/content/browser/tab_contents/page_navigator.h b/content/browser/tab_contents/page_navigator.h
index e411c24..3cb3133 100644
--- a/content/browser/tab_contents/page_navigator.h
+++ b/content/browser/tab_contents/page_navigator.h
@@ -10,7 +10,7 @@
#define CONTENT_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_
#pragma once
-#include "chrome/common/page_transition_types.h"
+#include "content/common/page_transition_types.h"
#include "webkit/glue/window_open_disposition.h"
class GURL;
diff --git a/content/browser/tab_contents/provisional_load_details.h b/content/browser/tab_contents/provisional_load_details.h
index 092d186..81f9ad2 100644
--- a/content/browser/tab_contents/provisional_load_details.h
+++ b/content/browser/tab_contents/provisional_load_details.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "chrome/common/page_transition_types.h"
+#include "content/common/page_transition_types.h"
#include "googleurl/src/gurl.h"
// This class captures some of the information associated to the provisional
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index 7dd45c5..728705f 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/browser/browser_url_handler.h"
-#include "chrome/common/page_transition_types.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/url_constants.h"
@@ -18,6 +17,7 @@
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
+#include "content/common/page_transition_types.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webkit_glue.h"
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 4285b95..be64ae1 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -66,7 +66,6 @@
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/url_pattern.h"
-#include "chrome/common/navigation_types.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
@@ -87,6 +86,7 @@
#include "content/browser/tab_contents/tab_contents_observer.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/web_ui.h"
+#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "net/base/net_util.h"
#include "net/base/registry_controlled_domain.h"
diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h
index a079198..42593a3 100644
--- a/content/browser/tab_contents/tab_contents_delegate.h
+++ b/content/browser/tab_contents/tab_contents_delegate.h
@@ -13,9 +13,9 @@
#include "chrome/browser/automation/automation_resource_routing_delegate.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/instant_types.h"
-#include "chrome/common/navigation_types.h"
-#include "chrome/common/page_transition_types.h"
#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/common/navigation_types.h"
+#include "content/common/page_transition_types.h"
#include "ui/gfx/native_widget_types.h"
#include "webkit/glue/window_open_disposition.h"
diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_tab_contents.cc
index b9a0c00..53a494c 100644
--- a/content/browser/tab_contents/test_tab_contents.cc
+++ b/content/browser/tab_contents/test_tab_contents.cc
@@ -8,13 +8,13 @@
#include "chrome/browser/browser_url_handler.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/common/page_transition_types.h"
#include "content/browser/renderer_host/mock_render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
+#include "content/common/page_transition_types.h"
TestTabContents::TestTabContents(Profile* profile, SiteInstance* instance)
: TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL),
diff --git a/content/browser/webui/web_ui.h b/content/browser/webui/web_ui.h
index 8dbabe5..2272b13 100644
--- a/content/browser/webui/web_ui.h
+++ b/content/browser/webui/web_ui.h
@@ -12,7 +12,7 @@
#include "base/callback.h"
#include "base/string16.h"
-#include "chrome/common/page_transition_types.h"
+#include "content/common/page_transition_types.h"
class DictionaryValue;
class WebUIMessageHandler;
diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc
index 1737521..bc29bca 100644
--- a/content/browser/worker_host/worker_process_host.cc
+++ b/content/browser/worker_host/worker_process_host.cc
@@ -18,7 +18,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "chrome/common/result_codes.h"
#include "content/browser/appcache/appcache_dispatcher_host.h"
#include "content/browser/browser_thread.h"
#include "content/browser/child_process_security_policy.h"
@@ -35,6 +34,7 @@
#include "content/browser/worker_host/worker_message_filter.h"
#include "content/browser/worker_host/worker_service.h"
#include "content/common/debug_flags.h"
+#include "content/common/result_codes.h"
#include "content/common/worker_messages.h"
#include "net/base/mime_util.h"
#include "ipc/ipc_switches.h"
diff --git a/content/browser/zygote_host_linux.cc b/content/browser/zygote_host_linux.cc
index 1eee6f3..e64631c 100644
--- a/content/browser/zygote_host_linux.cc
+++ b/content/browser/zygote_host_linux.cc
@@ -23,9 +23,9 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/process_watcher.h"
-#include "chrome/common/result_codes.h"
#include "content/browser/renderer_host/render_sandbox_host_linux.h"
+#include "content/common/process_watcher.h"
+#include "content/common/result_codes.h"
#include "content/common/unix_domain_socket_posix.h"
#include "sandbox/linux/suid/suid_unsafe_environment_variables.h"
diff --git a/content/browser/zygote_main_linux.cc b/content/browser/zygote_main_linux.cc
index b8fde82..ba6bcb1 100644
--- a/content/browser/zygote_main_linux.cc
+++ b/content/browser/zygote_main_linux.cc
@@ -39,12 +39,12 @@
#include "chrome/common/chrome_descriptors.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pepper_plugin_registry.h"
-#include "chrome/common/process_watcher.h"
-#include "chrome/common/result_codes.h"
-#include "chrome/common/sandbox_methods_linux.h"
-#include "chrome/common/set_process_title.h"
#include "content/common/font_config_ipc_linux.h"
#include "content/common/main_function_params.h"
+#include "content/common/process_watcher.h"
+#include "content/common/result_codes.h"
+#include "content/common/sandbox_methods_linux.h"
+#include "content/common/set_process_title.h"
#include "content/common/unix_domain_socket_posix.h"
#include "media/base/media.h"
#include "seccompsandbox/sandbox.h"
diff --git a/content/common/common.sb b/content/common/common.sb
new file mode 100644
index 0000000..ec97f66
--- /dev/null
+++ b/content/common/common.sb
@@ -0,0 +1,36 @@
+;;
+;; Copyright (c) 2010 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.
+;;
+; This configuration file isn't used on it's own, but instead implicitly
+; included at the start of all other sandbox configuration files in Chrome.
+(version 1)
+
+; DISABLE_SANDBOX_DENIAL_LOGGING expands to syntax that turns off log message
+; printing on sandbox exceptions; this functionality only exists on 10.6. The
+; --enable-sandbox-logging flag or system versions <10.6 cause this flag to
+; expand to an empty string. http://crbug.com/26621
+(deny default @DISABLE_SANDBOX_DENIAL_LOGGING@)
+
+; Support for programmatically enabling verbose debugging.
+;ENABLE_LOGGING (debug deny)
+
+; Allow sending signals to self - http://crbug.com/20370
+(allow signal (target self))
+
+; Needed for full-page-zoomed controls - http://crbug.com/11325
+(allow sysctl-read)
+
+; Each line is marked with the System version that needs it.
+; This profile is tested with the following system versions:
+; 10.5.6, 10.6
+
+; Loading System Libraries.
+(allow file-read*
+ (regex #"^/System/Library/Frameworks($|/)")
+ (regex #"^/System/Library/PrivateFrameworks($|/)")
+ (regex #"^/System/Library/CoreServices($|/)")) ; 10.5.6
+
+; Needed for IPC on 10.6
+;10.6_ONLY (allow ipc-posix-shm)
diff --git a/content/common/native_web_keyboard_event.h b/content/common/native_web_keyboard_event.h
new file mode 100644
index 0000000..08de652
--- /dev/null
+++ b/content/common/native_web_keyboard_event.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2009 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.
+
+#ifndef CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
+#define CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#elif defined(OS_MACOSX)
+#ifdef __OBJC__
+@class NSEvent;
+#else
+class NSEvent;
+#endif // __OBJC__
+#elif defined(OS_POSIX)
+typedef struct _GdkEventKey GdkEventKey;
+#endif
+
+// Owns a platform specific event; used to pass own and pass event through
+// platform independent code.
+struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
+ NativeWebKeyboardEvent();
+
+#if defined(OS_WIN)
+ NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+#elif defined(OS_MACOSX)
+ explicit NativeWebKeyboardEvent(NSEvent *event);
+ NativeWebKeyboardEvent(wchar_t character,
+ int state,
+ double time_stamp_seconds);
+#elif defined(TOOLKIT_USES_GTK)
+ explicit NativeWebKeyboardEvent(const GdkEventKey* event);
+ NativeWebKeyboardEvent(wchar_t character,
+ int state,
+ double time_stamp_seconds);
+#endif
+
+ NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
+ ~NativeWebKeyboardEvent();
+
+ NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event);
+
+#if defined(OS_WIN)
+ MSG os_event;
+#elif defined(OS_MACOSX)
+ NSEvent* os_event;
+#elif defined(TOOLKIT_USES_GTK)
+ GdkEventKey* os_event;
+#endif
+
+ // True if the browser should ignore this event if it's not handled by the
+ // renderer. This happens for RawKeyDown events that are created while IME is
+ // active and is necessary to prevent backspace from doing "history back" if
+ // it is hit in ime mode.
+ // Currently, it's only used by Linux and Mac ports.
+ bool skip_in_browser;
+
+#if defined(OS_LINUX)
+ // True if the key event matches an edit command. In order to ensure the edit
+ // command always work in web page, the browser should not pre-handle this key
+ // event as a reserved accelerator. See http://crbug.com/54573
+ bool match_edit_command;
+#endif
+};
+
+#endif // CONTENT_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_
diff --git a/content/common/native_web_keyboard_event_linux.cc b/content/common/native_web_keyboard_event_linux.cc
new file mode 100644
index 0000000..aebe7c4
--- /dev/null
+++ b/content/common/native_web_keyboard_event_linux.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2009 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/native_web_keyboard_event.h"
+
+#include <gdk/gdk.h>
+
+#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
+
+using WebKit::WebInputEventFactory;
+
+namespace {
+
+void CopyEventTo(const GdkEventKey* in, GdkEventKey** out) {
+ if (in) {
+ *out = reinterpret_cast<GdkEventKey*>(
+ gdk_event_copy(
+ reinterpret_cast<GdkEvent*>(const_cast<GdkEventKey*>(in))));
+ } else {
+ *out = NULL;
+ }
+}
+
+void FreeEvent(GdkEventKey* event) {
+ if (event) {
+ gdk_event_free(reinterpret_cast<GdkEvent*>(event));
+ }
+}
+
+} // namespace
+
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent()
+ : os_event(NULL),
+ skip_in_browser(false),
+ match_edit_command(false) {
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(const GdkEventKey* native_event)
+ : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(native_event)),
+ skip_in_browser(false),
+ match_edit_command(false) {
+ CopyEventTo(native_event, &os_event);
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character,
+ int state,
+ double time_stamp_seconds)
+ : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character,
+ state,
+ time_stamp_seconds)),
+ os_event(NULL),
+ skip_in_browser(false),
+ match_edit_command(false) {
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(
+ const NativeWebKeyboardEvent& other)
+ : WebKeyboardEvent(other),
+ skip_in_browser(other.skip_in_browser),
+ match_edit_command(other.match_edit_command) {
+ CopyEventTo(other.os_event, &os_event);
+}
+
+NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
+ const NativeWebKeyboardEvent& other) {
+ WebKeyboardEvent::operator=(other);
+
+ FreeEvent(os_event);
+ CopyEventTo(other.os_event, &os_event);
+
+ skip_in_browser = other.skip_in_browser;
+ match_edit_command = other.match_edit_command;
+
+ return *this;
+}
+
+NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
+ FreeEvent(os_event);
+}
diff --git a/content/common/native_web_keyboard_event_mac.mm b/content/common/native_web_keyboard_event_mac.mm
new file mode 100644
index 0000000..0961753
--- /dev/null
+++ b/content/common/native_web_keyboard_event_mac.mm
@@ -0,0 +1,56 @@
+// Copyright (c) 2009 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/native_web_keyboard_event.h"
+
+#import <AppKit/AppKit.h>
+
+#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFactory.h"
+
+using WebKit::WebInputEventFactory;
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent()
+ : os_event(NULL),
+ skip_in_browser(false) {
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent* event)
+ : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(event)),
+ os_event([event retain]),
+ skip_in_browser(false) {
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character,
+ int modifiers,
+ double time_stamp_seconds)
+ : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character,
+ modifiers,
+ time_stamp_seconds)),
+ os_event(NULL),
+ skip_in_browser(false) {
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(
+ const NativeWebKeyboardEvent& other)
+ : WebKeyboardEvent(other),
+ os_event([other.os_event retain]),
+ skip_in_browser(other.skip_in_browser) {
+}
+
+NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
+ const NativeWebKeyboardEvent& other) {
+ WebKeyboardEvent::operator=(other);
+
+ NSObject* previous = os_event;
+ os_event = [other.os_event retain];
+ [previous release];
+
+ skip_in_browser = other.skip_in_browser;
+
+ return *this;
+}
+
+NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
+ [os_event release];
+}
diff --git a/content/common/native_web_keyboard_event_win.cc b/content/common/native_web_keyboard_event_win.cc
new file mode 100644
index 0000000..1cb04e6
--- /dev/null
+++ b/content/common/native_web_keyboard_event_win.cc
@@ -0,0 +1,54 @@
+// Copyright (c) 2009 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/native_web_keyboard_event.h"
+
+#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFactory.h"
+
+using WebKit::WebInputEventFactory;
+using WebKit::WebKeyboardEvent;
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent()
+ : skip_in_browser(false) {
+ memset(&os_event, 0, sizeof(os_event));
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(
+ HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
+ : WebKeyboardEvent(
+ WebInputEventFactory::keyboardEvent(hwnd, message, wparam, lparam)),
+ skip_in_browser(false) {
+ os_event.hwnd = hwnd;
+ os_event.message = message;
+ os_event.wParam = wparam;
+ os_event.lParam = lparam;
+}
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(
+ const NativeWebKeyboardEvent& other)
+ : WebKeyboardEvent(other),
+ skip_in_browser(other.skip_in_browser) {
+ os_event.hwnd = other.os_event.hwnd;
+ os_event.message = other.os_event.message;
+ os_event.wParam = other.os_event.wParam;
+ os_event.lParam = other.os_event.lParam;
+}
+
+NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
+ const NativeWebKeyboardEvent& other) {
+ WebKeyboardEvent::operator=(other);
+
+ os_event.hwnd = other.os_event.hwnd;
+ os_event.message = other.os_event.message;
+ os_event.wParam = other.os_event.wParam;
+ os_event.lParam = other.os_event.lParam;
+
+ skip_in_browser = other.skip_in_browser;
+
+ return *this;
+}
+
+NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
+ // Noop under windows
+}
diff --git a/content/common/navigation_gesture.h b/content/common/navigation_gesture.h
new file mode 100644
index 0000000..64ba5ed
--- /dev/null
+++ b/content/common/navigation_gesture.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2010 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.
+
+#ifndef CONTENT_COMMON_NAVIGATION_GESTURE_H_
+#define CONTENT_COMMON_NAVIGATION_GESTURE_H_
+#pragma once
+
+enum NavigationGesture {
+ // User initiated navigation/load.
+ NavigationGestureUser,
+ // Non-user initiated navigation/load. For example, onload- or
+ // setTimeout-triggered document.location changes and form.submits. See
+ // http://b/1046841 for some cases that should be treated this way but aren't.
+ NavigationGestureAuto,
+ // Initial state.
+ NavigationGestureUnknown,
+};
+
+#endif // CONTENT_COMMON_NAVIGATION_GESTURE_H_
diff --git a/content/common/navigation_types.h b/content/common/navigation_types.h
new file mode 100644
index 0000000..bff569d
--- /dev/null
+++ b/content/common/navigation_types.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2006-2008 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.
+
+#ifndef CONTENT_COMMON_NAVIGATION_TYPES_H_
+#define CONTENT_COMMON_NAVIGATION_TYPES_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+// Indicates different types of navigations that can occur that we will handle
+// separately.
+class NavigationType {
+ public:
+ enum Type {
+ // Unknown type.
+ UNKNOWN,
+
+ // A new page was navigated in the main frame.
+ NEW_PAGE,
+
+ // Renavigating to an existing navigation entry. The entry is guaranteed to
+ // exist in the list, or else it would be a new page or IGNORE navigation.
+ EXISTING_PAGE,
+
+ // The same page has been reloaded as a result of the user requesting
+ // navigation to that same page (like pressing Enter in the URL bar). This
+ // is not the same as an in-page navigation because we'll actually have a
+ // pending entry for the load, which is then meaningless.
+ SAME_PAGE,
+
+ // In page navigations are when the reference fragment changes. This will
+ // be in the main frame only (we won't even get notified of in-page
+ // subframe navigations). It may be for any page, not necessarily the last
+ // committed one (for example, whey going back to a page with a ref).
+ IN_PAGE,
+
+ // A new subframe was manually navigated by the user. We will create a new
+ // NavigationEntry so they can go back to the previous subframe content
+ // using the back button.
+ NEW_SUBFRAME,
+
+ // A subframe in the page was automatically loaded or navigated to such that
+ // a new navigation entry should not be created. There are two cases:
+ // 1. Stuff like iframes containing ads that the page loads automatically.
+ // The user doesn't want to see these, so we just update the existing
+ // navigation entry.
+ // 2. Going back/forward to previous subframe navigations. We don't create
+ // a new entry here either, just update the last committed entry.
+ // These two cases are actually pretty different, they just happen to
+ // require almost the same code to handle.
+ AUTO_SUBFRAME,
+
+ // Nothing happened. This happens when we get information about a page we
+ // don't know anything about. It can also happen when an iframe in a popup
+ // navigated to about:blank is navigated. Nothing needs to be done.
+ NAV_IGNORE,
+ };
+
+ private:
+ // This class is for scoping only, so you shouldn't create an instance of it.
+ NavigationType() {}
+
+ DISALLOW_COPY_AND_ASSIGN(NavigationType);
+};
+
+#endif // CONTENT_COMMON_NAVIGATION_TYPES_H_
diff --git a/content/common/page_transition_types.cc b/content/common/page_transition_types.cc
new file mode 100644
index 0000000..8b7843b
--- /dev/null
+++ b/content/common/page_transition_types.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2010 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/page_transition_types.h"
+
+#include "base/logging.h"
+
+// static
+PageTransition::Type PageTransition::FromInt(int32 type) {
+ if (!ValidType(type)) {
+ NOTREACHED() << "Invalid transition type " << type;
+
+ // Return a safe default so we don't have corrupt data in release mode.
+ return LINK;
+ }
+ return static_cast<Type>(type);
+}
+
+// static
+const char* PageTransition::CoreTransitionString(Type type) {
+ switch (type & PageTransition::CORE_MASK) {
+ case 0: return "link";
+ case 1: return "typed";
+ case 2: return "auto_bookmark";
+ case 3: return "auto_subframe";
+ case 4: return "manual_subframe";
+ case 5: return "generated";
+ case 6: return "start_page";
+ case 7: return "form_submit";
+ case 8: return "reload";
+ case 9: return "keyword";
+ case 10: return "keyword_generated";
+ }
+ return NULL;
+}
diff --git a/content/common/page_transition_types.h b/content/common/page_transition_types.h
new file mode 100644
index 0000000..5295d5e
--- /dev/null
+++ b/content/common/page_transition_types.h
@@ -0,0 +1,165 @@
+// Copyright (c) 2010 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.
+
+#ifndef CONTENT_COMMON_PAGE_TRANSITION_TYPES_H_
+#define CONTENT_COMMON_PAGE_TRANSITION_TYPES_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+// This class is for scoping only.
+class PageTransition {
+ public:
+ // Types of transitions between pages. These are stored in the history
+ // database to separate visits, and are reported by the renderer for page
+ // navigations.
+ //
+ // WARNING: don't change these numbers. They are written directly into the
+ // history database, so future versions will need the same values to match
+ // the enums.
+ //
+ // A type is made of a core value and a set of qualifiers. A type has one
+ // core value and 0 or or more qualifiers.
+ enum {
+ // User got to this page by clicking a link on another page.
+ LINK = 0,
+
+ // User got this page by typing the URL in the URL bar. This should not be
+ // used for cases where the user selected a choice that didn't look at all
+ // like a URL; see GENERATED below.
+ //
+ // We also use this for other "explicit" navigation actions.
+ TYPED = 1,
+
+ // User got to this page through a suggestion in the UI, for example,
+ // through the destinations page.
+ AUTO_BOOKMARK = 2,
+
+ // This is a subframe navigation. This is any content that is automatically
+ // loaded in a non-toplevel frame. For example, if a page consists of
+ // several frames containing ads, those ad URLs will have this transition
+ // type. The user may not even realize the content in these pages is a
+ // separate frame, so may not care about the URL (see MANUAL below).
+ AUTO_SUBFRAME = 3,
+
+ // For subframe navigations that are explicitly requested by the user and
+ // generate new navigation entries in the back/forward list. These are
+ // probably more important than frames that were automatically loaded in
+ // the background because the user probably cares about the fact that this
+ // link was loaded.
+ MANUAL_SUBFRAME = 4,
+
+ // User got to this page by typing in the URL bar and selecting an entry
+ // that did not look like a URL. For example, a match might have the URL
+ // of a Google search result page, but appear like "Search Google for ...".
+ // These are not quite the same as TYPED navigations because the user
+ // didn't type or see the destination URL.
+ // See also KEYWORD.
+ GENERATED = 5,
+
+ // The page was specified in the command line or is the start page.
+ START_PAGE = 6,
+
+ // The user filled out values in a form and submitted it. NOTE that in
+ // some situations submitting a form does not result in this transition
+ // type. This can happen if the form uses script to submit the contents.
+ FORM_SUBMIT = 7,
+
+ // The user "reloaded" the page, either by hitting the reload button or by
+ // hitting enter in the address bar. NOTE: This is distinct from the
+ // concept of whether a particular load uses "reload semantics" (i.e.
+ // bypasses cached data). For this reason, lots of code needs to pass
+ // around the concept of whether a load should be treated as a "reload"
+ // separately from their tracking of this transition type, which is mainly
+ // used for proper scoring for consumers who care about how frequently a
+ // user typed/visited a particular URL.
+ //
+ // SessionRestore and undo tab close use this transition type too.
+ RELOAD = 8,
+
+ // The url was generated from a replaceable keyword other than the default
+ // search provider. If the user types a keyword (which also applies to
+ // tab-to-search) in the omnibox this qualifier is applied to the transition
+ // type of the generated url. TemplateURLModel then may generate an
+ // additional visit with a transition type of KEYWORD_GENERATED against the
+ // url 'http://' + keyword. For example, if you do a tab-to-search against
+ // wikipedia the generated url has a transition qualifer of KEYWORD, and
+ // TemplateURLModel generates a visit for 'wikipedia.org' with a transition
+ // type of KEYWORD_GENERATED.
+ KEYWORD = 9,
+
+ // Corresponds to a visit generated for a keyword. See description of
+ // KEYWORD for more details.
+ KEYWORD_GENERATED = 10,
+
+ // ADDING NEW CORE VALUE? Be sure to update the LAST_CORE and CORE_MASK
+ // values below. Also update CoreTransitionString().
+ LAST_CORE = KEYWORD_GENERATED,
+ CORE_MASK = 0xFF,
+
+ // Qualifiers
+ // Any of the core values above can be augmented by one or more qualifiers.
+ // These qualifiers further define the transition.
+
+ // User used the Forward or Back button to navigate among browsing history.
+ FORWARD_BACK = 0x01000000,
+
+ // The beginning of a navigation chain.
+ CHAIN_START = 0x10000000,
+
+ // The last transition in a redirect chain.
+ CHAIN_END = 0x20000000,
+
+ // Redirects caused by JavaScript or a meta refresh tag on the page.
+ CLIENT_REDIRECT = 0x40000000,
+
+ // Redirects sent from the server by HTTP headers. It might be nice to
+ // break this out into 2 types in the future, permanent or temporary, if we
+ // can get that information from WebKit.
+ SERVER_REDIRECT = 0x80000000,
+
+ // Used to test whether a transition involves a redirect.
+ IS_REDIRECT_MASK = 0xC0000000,
+
+ // General mask defining the bits used for the qualifiers.
+ QUALIFIER_MASK = 0xFFFFFF00
+ };
+
+ // The type used for the bitfield.
+ typedef unsigned int Type;
+
+ static bool ValidType(int32 type) {
+ Type t = StripQualifier(static_cast<Type>(type));
+ return (t <= LAST_CORE);
+ }
+
+ static Type FromInt(int32 type);
+
+ // Returns true if the given transition is a top-level frame transition, or
+ // false if the transition was for a subframe.
+ static bool IsMainFrame(Type type) {
+ int32 t = StripQualifier(type);
+ return (t != AUTO_SUBFRAME && t != MANUAL_SUBFRAME);
+ }
+
+ // Returns whether a transition involves a redirection
+ static bool IsRedirect(Type type) {
+ return (type & IS_REDIRECT_MASK) != 0;
+ }
+
+ // Simplifies the provided transition by removing any qualifier
+ static Type StripQualifier(Type type) {
+ return static_cast<Type>(type & ~QUALIFIER_MASK);
+ }
+
+ // Return the qualifier
+ static int32 GetQualifier(Type type) {
+ return type & QUALIFIER_MASK;
+ }
+
+ // Return a string version of the core type values.
+ static const char* CoreTransitionString(Type type);
+};
+
+#endif // CONTENT_COMMON_PAGE_TRANSITION_TYPES_H_
diff --git a/content/common/page_type.h b/content/common/page_type.h
new file mode 100644
index 0000000..85a2592
--- /dev/null
+++ b/content/common/page_type.h
@@ -0,0 +1,17 @@
+// Copyright (c) 2009 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.
+
+#ifndef CONTENT_COMMON_PAGE_TYPE_H_
+#define CONTENT_COMMON_PAGE_TYPE_H_
+#pragma once
+
+// The type of the page an entry corresponds to. Used by chrome_frame and the
+// automation layer to detect the state of a TabContents.
+enum PageType {
+ NORMAL_PAGE = 0,
+ ERROR_PAGE,
+ INTERSTITIAL_PAGE
+};
+
+#endif // CONTENT_COMMON_PAGE_TYPE_H_
diff --git a/content/common/page_zoom.h b/content/common/page_zoom.h
new file mode 100644
index 0000000..d4606c0
--- /dev/null
+++ b/content/common/page_zoom.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2009 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.
+
+#ifndef CONTENT_COMMON_PAGE_ZOOM_H_
+#define CONTENT_COMMON_PAGE_ZOOM_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+class PageZoom {
+ public:
+ // This enum is the parameter to various text/page zoom commands so we know
+ // what the specific zoom command is.
+ enum Function {
+ ZOOM_OUT = -1,
+ RESET = 0,
+ ZOOM_IN = 1,
+ };
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PageZoom);
+};
+
+#endif // CONTENT_COMMON_PAGE_ZOOM_H_
diff --git a/content/common/process_watcher.h b/content/common/process_watcher.h
new file mode 100644
index 0000000..2a134be
--- /dev/null
+++ b/content/common/process_watcher.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2006-2008 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.
+
+#ifndef CONTENT_COMMON_PROCESS_WATCHER_H_
+#define CONTENT_COMMON_PROCESS_WATCHER_H_
+#pragma once
+
+#include "build/build_config.h"
+
+#include "base/basictypes.h"
+#include "base/process.h"
+
+class ProcessWatcher {
+ public:
+ // This method ensures that the specified process eventually terminates, and
+ // then it closes the given process handle.
+ //
+ // It assumes that the process has already been signalled to exit, and it
+ // begins by waiting a small amount of time for it to exit. If the process
+ // does not appear to have exited, then this function starts to become
+ // aggressive about ensuring that the process terminates.
+ //
+ // On Linux this method does not block the calling thread.
+ // On OS X this method may block for up to 2 seconds.
+ //
+ // NOTE: The process handle must have been opened with the PROCESS_TERMINATE
+ // and SYNCHRONIZE permissions.
+ //
+ static void EnsureProcessTerminated(base::ProcessHandle process_handle);
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ // The nicer version of EnsureProcessTerminated() that is patient and will
+ // wait for |process_handle| to finish and then reap it.
+ static void EnsureProcessGetsReaped(base::ProcessHandle process_handle);
+#endif
+
+ private:
+ // Do not instantiate this class.
+ ProcessWatcher();
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessWatcher);
+};
+
+#endif // CONTENT_COMMON_PROCESS_WATCHER_H_
diff --git a/content/common/process_watcher_mac.cc b/content/common/process_watcher_mac.cc
new file mode 100644
index 0000000..5db9903
--- /dev/null
+++ b/content/common/process_watcher_mac.cc
@@ -0,0 +1,170 @@
+// Copyright (c) 2009 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/process_watcher.h"
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/event.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "base/eintr_wrapper.h"
+#include "base/file_util.h"
+#include "base/time.h"
+
+namespace {
+
+const int kWaitBeforeKillSeconds = 2;
+
+// Reap |child| process. This call blocks until completion.
+void BlockingReap(pid_t child) {
+ const pid_t result = HANDLE_EINTR(waitpid(child, NULL, 0));
+ if (result == -1) {
+ PLOG(ERROR) << "waitpid(" << child << ", NULL, 0)";
+ }
+}
+
+// Waits for |timeout| seconds for the given |child| to exit and reap it. If
+// the child doesn't exit within the time specified, kills it.
+//
+// This function takes two approaches: first, it tries to use kqueue to
+// observe when the process exits. kevent can monitor a kqueue with a
+// timeout, so this method is preferred to wait for a specified period of
+// time. Once the kqueue indicates the process has exited, waitpid will reap
+// the exited child. If the kqueue doesn't provide an exit event notification,
+// before the timeout expires, or if the kqueue fails or misbehaves, the
+// process will be mercilessly killed and reaped.
+//
+// A child process passed to this function may be in one of several states:
+// running, terminated and not yet reaped, and (apparently, and unfortunately)
+// terminated and already reaped. Normally, a process will at least have been
+// asked to exit before this function is called, but this is not required.
+// If a process is terminating and unreaped, there may be a window between the
+// time that kqueue will no longer recognize it and when it becomes an actual
+// zombie that a non-blocking (WNOHANG) waitpid can reap. This condition is
+// detected when kqueue indicates that the process is not running and a
+// non-blocking waitpid fails to reap the process but indicates that it is
+// still running. In this event, a blocking attempt to reap the process
+// collects the known-dying child, preventing zombies from congregating.
+//
+// In the event that the kqueue misbehaves entirely, as it might under a
+// EMFILE condition ("too many open files", or out of file descriptors), this
+// function will forcibly kill and reap the child without delay. This
+// eliminates another potential zombie vector. (If you're out of file
+// descriptors, you're probably deep into something else, but that doesn't
+// mean that zombies be allowed to kick you while you're down.)
+//
+// The fact that this function seemingly can be called to wait on a child
+// that's not only already terminated but already reaped is a bit of a
+// problem: a reaped child's pid can be reclaimed and may refer to a distinct
+// process in that case. The fact that this function can seemingly be called
+// to wait on a process that's not even a child is also a problem: kqueue will
+// work in that case, but waitpid won't, and killing a non-child might not be
+// the best approach.
+void WaitForChildToDie(pid_t child, int timeout) {
+ DCHECK(child > 0);
+ DCHECK(timeout > 0);
+
+ // DON'T ADD ANY EARLY RETURNS TO THIS FUNCTION without ensuring that
+ // |child| has been reaped. Specifically, even if a kqueue, kevent, or other
+ // call fails, this function should fall back to the last resort of trying
+ // to kill and reap the process. Not observing this rule will resurrect
+ // zombies.
+
+ int result;
+
+ int kq = HANDLE_EINTR(kqueue());
+ if (kq == -1) {
+ PLOG(ERROR) << "kqueue()";
+ } else {
+ file_util::ScopedFD auto_close_kq(&kq);
+
+ struct kevent change = {0};
+ EV_SET(&change, child, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
+ result = HANDLE_EINTR(kevent(kq, &change, 1, NULL, 0, NULL));
+
+ if (result == -1) {
+ if (errno != ESRCH) {
+ PLOG(ERROR) << "kevent (setup " << child << ")";
+ } else {
+ // At this point, one of the following has occurred:
+ // 1. The process has died but has not yet been reaped.
+ // 2. The process has died and has already been reaped.
+ // 3. The process is in the process of dying. It's no longer
+ // kqueueable, but it may not be waitable yet either. Mark calls
+ // this case the "zombie death race".
+
+ result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
+
+ if (result != 0) {
+ // A positive result indicates case 1. waitpid succeeded and reaped
+ // the child. A result of -1 indicates case 2. The child has already
+ // been reaped. In both of these cases, no further action is
+ // necessary.
+ return;
+ }
+
+ // |result| is 0, indicating case 3. The process will be waitable in
+ // short order. Fall back out of the kqueue code to kill it (for good
+ // measure) and reap it.
+ }
+ } else {
+ // Keep track of the elapsed time to be able to restart kevent if it's
+ // interrupted.
+ base::TimeDelta remaining_delta = base::TimeDelta::FromSeconds(timeout);
+ base::Time deadline = base::Time::Now() + remaining_delta;
+ result = -1;
+ struct kevent event = {0};
+ while (remaining_delta.InMilliseconds() > 0) {
+ const struct timespec remaining_timespec = remaining_delta.ToTimeSpec();
+ result = kevent(kq, NULL, 0, &event, 1, &remaining_timespec);
+ if (result == -1 && errno == EINTR) {
+ remaining_delta = deadline - base::Time::Now();
+ result = 0;
+ } else {
+ break;
+ }
+ }
+
+ if (result == -1) {
+ PLOG(ERROR) << "kevent (wait " << child << ")";
+ } else if (result > 1) {
+ LOG(ERROR) << "kevent (wait " << child << "): unexpected result "
+ << result;
+ } else if (result == 1) {
+ if ((event.fflags & NOTE_EXIT) &&
+ (event.ident == static_cast<uintptr_t>(child))) {
+ // The process is dead or dying. This won't block for long, if at
+ // all.
+ BlockingReap(child);
+ return;
+ } else {
+ LOG(ERROR) << "kevent (wait " << child
+ << "): unexpected event: fflags=" << event.fflags
+ << ", ident=" << event.ident;
+ }
+ }
+ }
+ }
+
+ // The child is still alive, or is very freshly dead. Be sure by sending it
+ // a signal. This is safe even if it's freshly dead, because it will be a
+ // zombie (or on the way to zombiedom) and kill will return 0 even if the
+ // signal is not delivered to a live process.
+ result = kill(child, SIGKILL);
+ if (result == -1) {
+ PLOG(ERROR) << "kill(" << child << ", SIGKILL)";
+ } else {
+ // The child is definitely on the way out now. BlockingReap won't need to
+ // wait for long, if at all.
+ BlockingReap(child);
+ }
+}
+
+} // namespace
+
+void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
+ WaitForChildToDie(process, kWaitBeforeKillSeconds);
+}
diff --git a/content/common/process_watcher_posix.cc b/content/common/process_watcher_posix.cc
new file mode 100644
index 0000000..85f8ace
--- /dev/null
+++ b/content/common/process_watcher_posix.cc
@@ -0,0 +1,105 @@
+// Copyright (c) 2009 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/process_watcher.h"
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "base/eintr_wrapper.h"
+#include "base/logging.h"
+#include "base/threading/platform_thread.h"
+
+// Return true if the given child is dead. This will also reap the process.
+// Doesn't block.
+static bool IsChildDead(pid_t child) {
+ const pid_t result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
+ if (result == -1) {
+ PLOG(ERROR) << "waitpid(" << child << ")";
+ NOTREACHED();
+ } else if (result > 0) {
+ // The child has died.
+ return true;
+ }
+
+ return false;
+}
+
+// A thread class which waits for the given child to exit and reaps it.
+// If the child doesn't exit within a couple of seconds, kill it.
+class BackgroundReaper : public base::PlatformThread::Delegate {
+ public:
+ explicit BackgroundReaper(pid_t child, unsigned timeout)
+ : child_(child),
+ timeout_(timeout) {
+ }
+
+ void ThreadMain() {
+ WaitForChildToDie();
+ delete this;
+ }
+
+ void WaitForChildToDie() {
+ // Wait forever case.
+ if (timeout_ == 0) {
+ pid_t r = HANDLE_EINTR(waitpid(child_, NULL, 0));
+ if (r != child_) {
+ PLOG(ERROR) << "While waiting for " << child_
+ << " to terminate, we got the following result: " << r;
+ }
+ return;
+ }
+
+ // There's no good way to wait for a specific child to exit in a timed
+ // fashion. (No kqueue on Linux), so we just loop and sleep.
+
+ // Wait for 2 * timeout_ 500 milliseconds intervals.
+ for (unsigned i = 0; i < 2 * timeout_; ++i) {
+ base::PlatformThread::Sleep(500); // 0.5 seconds
+ if (IsChildDead(child_))
+ return;
+ }
+
+ if (kill(child_, SIGKILL) == 0) {
+ // SIGKILL is uncatchable. Since the signal was delivered, we can
+ // just wait for the process to die now in a blocking manner.
+ if (HANDLE_EINTR(waitpid(child_, NULL, 0)) < 0)
+ PLOG(WARNING) << "waitpid";
+ } else {
+ LOG(ERROR) << "While waiting for " << child_ << " to terminate we"
+ << " failed to deliver a SIGKILL signal (" << errno << ").";
+ }
+ }
+
+ private:
+ const pid_t child_;
+ // Number of seconds to wait, if 0 then wait forever and do not attempt to
+ // kill |child_|.
+ const unsigned timeout_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundReaper);
+};
+
+// static
+void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
+ // If the child is already dead, then there's nothing to do.
+ if (IsChildDead(process))
+ return;
+
+ const unsigned timeout = 2; // seconds
+ BackgroundReaper* reaper = new BackgroundReaper(process, timeout);
+ base::PlatformThread::CreateNonJoinable(0, reaper);
+}
+
+// static
+void ProcessWatcher::EnsureProcessGetsReaped(base::ProcessHandle process) {
+ // If the child is already dead, then there's nothing to do.
+ if (IsChildDead(process))
+ return;
+
+ BackgroundReaper* reaper = new BackgroundReaper(process, 0);
+ base::PlatformThread::CreateNonJoinable(0, reaper);
+}
diff --git a/content/common/process_watcher_unittest.cc b/content/common/process_watcher_unittest.cc
new file mode 100644
index 0000000..260075b
--- /dev/null
+++ b/content/common/process_watcher_unittest.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2009 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/process_watcher.h"
+
+#if defined(OS_POSIX)
+#include <sys/wait.h>
+
+#include "base/eintr_wrapper.h"
+#include "base/process_util.h"
+#include "base/test/multiprocess_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/multiprocess_func_list.h"
+
+class ProcessWatcherTest : public base::MultiProcessTest {
+};
+
+namespace {
+
+bool IsProcessDead(base::ProcessHandle child) {
+ // waitpid() will actually reap the process which is exactly NOT what we
+ // want to test for. The good thing is that if it can't find the process
+ // we'll get a nice value for errno which we can test for.
+ const pid_t result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
+ return result == -1 && errno == ECHILD;
+}
+
+} // namespace
+
+TEST_F(ProcessWatcherTest, DelayedTermination) {
+ base::ProcessHandle child_process =
+ SpawnChild("process_watcher_test_never_die", false);
+ ProcessWatcher::EnsureProcessTerminated(child_process);
+ base::WaitForSingleProcess(child_process, 5000);
+
+ // Check that process was really killed.
+ EXPECT_TRUE(IsProcessDead(child_process));
+ base::CloseProcessHandle(child_process);
+}
+
+MULTIPROCESS_TEST_MAIN(process_watcher_test_never_die) {
+ while (1) {
+ sleep(500);
+ }
+ return 0;
+}
+
+TEST_F(ProcessWatcherTest, ImmediateTermination) {
+ base::ProcessHandle child_process =
+ SpawnChild("process_watcher_test_die_immediately", false);
+ // Give it time to die.
+ sleep(2);
+ ProcessWatcher::EnsureProcessTerminated(child_process);
+
+ // Check that process was really killed.
+ EXPECT_TRUE(IsProcessDead(child_process));
+ base::CloseProcessHandle(child_process);
+}
+
+MULTIPROCESS_TEST_MAIN(process_watcher_test_die_immediately) {
+ return 0;
+}
+
+#endif // OS_POSIX
diff --git a/content/common/process_watcher_win.cc b/content/common/process_watcher_win.cc
new file mode 100644
index 0000000..c1ccbf8
--- /dev/null
+++ b/content/common/process_watcher_win.cc
@@ -0,0 +1,84 @@
+// Copyright (c) 2010 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/process_watcher.h"
+
+#include "base/scoped_ptr.h"
+#include "base/message_loop.h"
+#include "base/win/object_watcher.h"
+#include "content/common/result_codes.h"
+
+// Maximum amount of time (in milliseconds) to wait for the process to exit.
+static const int kWaitInterval = 2000;
+
+namespace {
+
+class TimerExpiredTask : public Task,
+ public base::win::ObjectWatcher::Delegate {
+ public:
+ explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) {
+ watcher_.StartWatching(process_, this);
+ }
+
+ virtual ~TimerExpiredTask() {
+ if (process_) {
+ KillProcess();
+ DCHECK(!process_) << "Make sure to close the handle.";
+ }
+ }
+
+ // Task ---------------------------------------------------------------------
+
+ virtual void Run() {
+ if (process_)
+ KillProcess();
+ }
+
+ // MessageLoop::Watcher -----------------------------------------------------
+
+ virtual void OnObjectSignaled(HANDLE object) {
+ // When we're called from KillProcess, the ObjectWatcher may still be
+ // watching. the process handle, so make sure it has stopped.
+ watcher_.StopWatching();
+
+ CloseHandle(process_);
+ process_ = NULL;
+ }
+
+ private:
+ void KillProcess() {
+ // OK, time to get frisky. We don't actually care when the process
+ // terminates. We just care that it eventually terminates, and that's what
+ // TerminateProcess should do for us. Don't check for the result code since
+ // it fails quite often. This should be investigated eventually.
+ base::KillProcess(process_, ResultCodes::HUNG, false);
+
+ // Now, just cleanup as if the process exited normally.
+ OnObjectSignaled(process_);
+ }
+
+ // The process that we are watching.
+ base::ProcessHandle process_;
+
+ base::win::ObjectWatcher watcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(TimerExpiredTask);
+};
+
+} // namespace
+
+// static
+void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
+ DCHECK(process != GetCurrentProcess());
+
+ // If already signaled, then we are done!
+ if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) {
+ CloseHandle(process);
+ return;
+ }
+
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ new TimerExpiredTask(process),
+ kWaitInterval);
+}
diff --git a/content/common/result_codes.h b/content/common/result_codes.h
new file mode 100644
index 0000000..fe6eb72
--- /dev/null
+++ b/content/common/result_codes.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2010 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.
+
+#ifndef CONTENT_COMMON_RESULT_CODES_H_
+#define CONTENT_COMMON_RESULT_CODES_H_
+#pragma once
+
+#include "base/process_util.h"
+
+// This file consolidates all the return codes for the browser and renderer
+// process. The return code is the value that:
+// a) is returned by main() or winmain(), or
+// b) specified in the call for ExitProcess() or TerminateProcess(), or
+// c) the exception value that causes a process to terminate.
+//
+// It is advisable to not use negative numbers because the Windows API returns
+// it as an unsigned long and the exception values have high numbers. For
+// example EXCEPTION_ACCESS_VIOLATION value is 0xC0000005.
+
+class ResultCodes {
+ public:
+ enum ExitCode {
+ NORMAL_EXIT = 0, // Process terminated normally.
+ KILLED = 1, // Process was killed by user or system.
+ HUNG = 2, // Process hung.
+ INVALID_CMDLINE_URL, // An invalid command line url was given.
+ SBOX_INIT_FAILED, // The sandbox could not be initialized.
+ GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed.
+ GOOGLE_UPDATE_LAUNCH_FAILED,// Google Update could not launch chrome DLL.
+ BAD_PROCESS_TYPE, // The process is of an unknown type.
+ MISSING_PATH, // An critical chrome path is missing.
+ MISSING_DATA, // A critical chrome file is missing.
+ SHELL_INTEGRATION_FAILED, // Failed to make Chrome default browser.
+ MACHINE_LEVEL_INSTALL_EXISTS, // Machine level install exists
+ UNINSTALL_DELETE_FILE_ERROR,// Error while deleting shortcuts.
+ UNINSTALL_CHROME_ALIVE, // Uninstall detected another chrome instance.
+ UNINSTALL_NO_SURVEY, // Do not launch survey after uninstall.
+ UNINSTALL_USER_CANCEL, // The user changed her mind.
+ UNINSTALL_DELETE_PROFILE, // Delete profile as well during uninstall.
+ UNSUPPORTED_PARAM, // Command line parameter is not supported.
+ KILLED_BAD_MESSAGE, // A bad message caused the process termination.
+ IMPORTER_CANCEL, // The user canceled the browser import.
+ IMPORTER_HUNG, // Browser import hung and was killed.
+ RESPAWN_FAILED, // Trying to restart the browser we crashed.
+
+ NORMAL_EXIT_EXP1, // The EXP1, EXP2, EXP3, EXP4 are generic codes
+ NORMAL_EXIT_EXP2, // used to communicate some simple outcome back
+ NORMAL_EXIT_EXP3, // to the process that launched us. This is
+ NORMAL_EXIT_EXP4, // used for experiments and the actual meaning
+ // depends on the experiment.
+
+ NORMAL_EXIT_CANCEL, // For experiments this return code means that
+ // the user canceled causes the did_run "dr"
+ // signal to be reset so this chrome run does
+ // not count as active chrome usage.
+
+ PROFILE_IN_USE, // The profile was in use on another host.
+
+ UNINSTALL_EXTENSION_ERROR, // Failed to silently uninstall an extension.
+ PACK_EXTENSION_ERROR, // Failed to pack an extension via the cmd line.
+
+ EXIT_LAST_CODE // Last return code (keep it last).
+ };
+};
+
+#endif // CONTENT_COMMON_RESULT_CODES_H_
diff --git a/content/common/sandbox_methods_linux.h b/content/common/sandbox_methods_linux.h
new file mode 100644
index 0000000..02287f6d
--- /dev/null
+++ b/content/common/sandbox_methods_linux.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2009 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.
+
+#ifndef CONTENT_COMMON_SANDBOX_METHODS_LINUX_H_
+#define CONTENT_COMMON_SANDBOX_METHODS_LINUX_H_
+#pragma once
+
+// This is a list of sandbox IPC methods which the renderer may send to the
+// sandbox host. See http://code.google.com/p/chromium/LinuxSandboxIPC
+// This isn't the full list, values < 32 are reserved for methods called from
+// Skia.
+class LinuxSandbox {
+ public:
+ enum Methods {
+ METHOD_GET_FONT_FAMILY_FOR_CHARS = 32,
+ METHOD_LOCALTIME = 33,
+ METHOD_GET_CHILD_WITH_INODE = 34,
+ METHOD_GET_STYLE_FOR_STRIKE = 35,
+ METHOD_MAKE_SHARED_MEMORY_SEGMENT = 36,
+ METHOD_MATCH_WITH_FALLBACK = 37,
+ };
+};
+
+#endif // CONTENT_COMMON_SANDBOX_METHODS_LINUX_H_
diff --git a/content/common/set_process_title.cc b/content/common/set_process_title.cc
new file mode 100644
index 0000000..3602e94
--- /dev/null
+++ b/content/common/set_process_title.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2010 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/set_process_title.h"
+
+#include "base/command_line.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/string_util.h"
+#include "build/build_config.h"
+
+#if defined(OS_POSIX)
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
+#if defined(OS_LINUX)
+#include <sys/prctl.h>
+
+// Linux/glibc doesn't natively have setproctitle().
+#include "content/common/set_process_title_linux.h"
+#endif
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+
+void SetProcessTitleFromCommandLine(char** main_argv) {
+ // Build a single string which consists of all the arguments separated
+ // by spaces. We can't actually keep them separate due to the way the
+ // setproctitle() function works.
+ std::string title;
+ bool have_argv0 = false;
+
+#if defined(OS_LINUX)
+ if (main_argv)
+ setproctitle_init(main_argv);
+
+ // In Linux we sometimes exec ourselves from /proc/self/exe, but this makes us
+ // show up as "exe" in process listings. Read the symlink /proc/self/exe and
+ // use the path it points at for our process title. Note that this is only for
+ // display purposes and has no TOCTTOU security implications.
+ FilePath target;
+ FilePath self_exe("/proc/self/exe");
+ if (file_util::ReadSymbolicLink(self_exe, &target)) {
+ have_argv0 = true;
+ title = target.value();
+ // If the binary has since been deleted, Linux appends " (deleted)" to the
+ // symlink target. Remove it, since this is not really part of our name.
+ const std::string kDeletedSuffix = " (deleted)";
+ if (EndsWith(title, kDeletedSuffix, true))
+ title.resize(title.size() - kDeletedSuffix.size());
+#if defined(PR_SET_NAME)
+ // If PR_SET_NAME is available at compile time, we try using it. We ignore
+ // any errors if the kernel does not support it at runtime though. When
+ // available, this lets us set the short process name that shows when the
+ // full command line is not being displayed in most process listings.
+ prctl(PR_SET_NAME, FilePath(title).BaseName().value().c_str());
+#endif
+ }
+#endif
+
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ for (size_t i = 1; i < command_line->argv().size(); ++i) {
+ if (!title.empty())
+ title += " ";
+ title += command_line->argv()[i];
+ }
+ // Disable prepending argv[0] with '-' if we prepended it ourselves above.
+ setproctitle(have_argv0 ? "-%s" : "%s", title.c_str());
+}
+
+#else
+
+// All other systems (basically Windows & Mac) have no need or way to implement
+// this function.
+void SetProcessTitleFromCommandLine(char** /* main_argv */) {
+}
+
+#endif
+
diff --git a/content/common/set_process_title.h b/content/common/set_process_title.h
new file mode 100644
index 0000000..8c689c6
--- /dev/null
+++ b/content/common/set_process_title.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 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.
+
+#ifndef CONTENT_COMMON_SET_PROCESS_TITLE_H_
+#define CONTENT_COMMON_SET_PROCESS_TITLE_H_
+
+// Sets OS-specific process title information based on the command line. This
+// does nothing if the OS doesn't support or need this capability.
+//
+// Pass in the argv from main(). On Windows, where there is no argv, you can
+// pass NULL or just don't call this function, since it does nothing. This
+// argv pointer will be cached so if you call this function again, you can pass
+// NULL in the second call. This is to support the case where it's called once
+// at startup, and later when a zygote is fork()ed. The later call doesn't have
+// easy access to main's argv.
+//
+// On non-Mac Unix platforms, we exec ourselves from /proc/self/exe, but that
+// makes the process name that shows up in "ps" etc. for the child processes
+// show as "exe" instead of "chrome" or something reasonable. This function
+// will try to fix it so the "effective" command line shows up instead.
+void SetProcessTitleFromCommandLine(char** main_argv);
+
+#endif // CONTENT_COMMON_SET_PROCESS_TITLE_H_
diff --git a/content/common/set_process_title_linux.cc b/content/common/set_process_title_linux.cc
new file mode 100644
index 0000000..ada0552
--- /dev/null
+++ b/content/common/set_process_title_linux.cc
@@ -0,0 +1,115 @@
+// Copyright (c) 2009 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.
+
+// This file implements BSD-style setproctitle() for Linux.
+// It is written such that it can easily be compiled outside Chromium.
+//
+// The Linux kernel sets up two locations in memory to pass arguments and
+// environment variables to processes. First, there are two char* arrays stored
+// one after another: argv and environ. A pointer to argv is passed to main(),
+// while glibc sets the global variable |environ| to point at the latter. Both
+// of these arrays are terminated by a NULL pointer; the environment array is
+// also followed by some empty space to allow additional variables to be added.
+//
+// These arrays contain pointers to a second location in memory, where the
+// strings themselves are stored one after another: first all the arguments,
+// then the environment variables. The kernel will allocate a single page of
+// memory for this purpose, so the end of the page containing argv[0] is the
+// end of the storage potentially available to store the process title.
+//
+// When the kernel reads the command line arguments for a process, it looks at
+// the range of memory within this page that it initially used for the argument
+// list. If the terminating '\0' character is still where it expects, nothing
+// further is done. If it has been overwritten, the kernel will scan up to the
+// size of a page looking for another. (Note, however, that in general not that
+// much space is actually mapped, since argv[0] is rarely page-aligned and only
+// one page is mapped.)
+//
+// Thus to change the process title, we must move any environment variables out
+// of the way to make room for a potentially longer title, and then overwrite
+// the memory pointed to by argv[0] with a single replacement string, making
+// sure its size does not exceed the available space.
+//
+// It is perhaps worth noting that patches to add a system call to Linux for
+// this, like in BSD, have never made it in: this is the "official" way to do
+// this on Linux. Presumably it is not in glibc due to some disagreement over
+// this position within the glibc project, leaving applications caught in the
+// middle. (Also, only a very few applications need or want this anyway.)
+
+#include "content/common/set_process_title_linux.h"
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+extern char** environ;
+
+static char** g_main_argv = NULL;
+static char* g_orig_argv0 = NULL;
+
+void setproctitle(const char* fmt, ...) {
+ va_list ap;
+ size_t i, avail_size;
+ uintptr_t page_size, page, page_end;
+ // Sanity check before we try and set the process title.
+ // The BSD version allows fmt == NULL to restore the original title.
+ if (!g_main_argv || !environ || !fmt)
+ return;
+ if (!g_orig_argv0) {
+ // Save the original argv[0].
+ g_orig_argv0 = strdup(g_main_argv[0]);
+ if (!g_orig_argv0)
+ return;
+ }
+ page_size = sysconf(_SC_PAGESIZE);
+ // Get the page on which the argument list and environment live.
+ page = (uintptr_t) g_main_argv[0];
+ page -= page % page_size;
+ page_end = page + page_size;
+ // Move the environment out of the way. Note that we are moving the values,
+ // not the environment array itself (which may not be on the page we need
+ // to overwrite anyway).
+ for (i = 0; environ[i]; ++i) {
+ uintptr_t env_i = (uintptr_t) environ[i];
+ // Only move the value if it's actually in the way. This avoids
+ // leaking copies of the values if this function is called again.
+ if (page <= env_i && env_i < page_end) {
+ char* copy = strdup(environ[i]);
+ // Be paranoid. Check for allocation failure and bail out.
+ if (!copy)
+ return;
+ environ[i] = copy;
+ }
+ }
+ // Put the title in argv[0]. We have to zero out the space first since the
+ // kernel doesn't actually look for a null terminator unless we make the
+ // argument list longer than it started.
+ avail_size = page_end - (uintptr_t) g_main_argv[0];
+ memset(g_main_argv[0], 0, avail_size);
+ va_start(ap, fmt);
+ if (fmt[0] == '-') {
+ vsnprintf(g_main_argv[0], avail_size, &fmt[1], ap);
+ } else {
+ size_t size = snprintf(g_main_argv[0], avail_size, "%s ", g_orig_argv0);
+ if (size < avail_size)
+ vsnprintf(g_main_argv[0] + size, avail_size - size, fmt, ap);
+ }
+ va_end(ap);
+ g_main_argv[1] = NULL;
+}
+
+// A version of this built into glibc would not need this function, since
+// it could stash the argv pointer in __libc_start_main(). But we need it.
+void setproctitle_init(char** main_argv) {
+ if (g_main_argv)
+ return;
+
+ uintptr_t page_size = sysconf(_SC_PAGESIZE);
+ // Check that the argv array is in fact on the same page of memory
+ // as the environment array just as an added measure of protection.
+ if (((uintptr_t) environ) / page_size == ((uintptr_t) main_argv) / page_size)
+ g_main_argv = main_argv;
+}
diff --git a/content/common/set_process_title_linux.h b/content/common/set_process_title_linux.h
new file mode 100644
index 0000000..a33dfe3
--- /dev/null
+++ b/content/common/set_process_title_linux.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2009 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.
+
+#ifndef CONTENT_COMMON_SET_PROCESS_TITLE_LINUX_H_
+#define CONTENT_COMMON_SET_PROCESS_TITLE_LINUX_H_
+#pragma once
+
+// Set the process title that will show in "ps" and similar tools. Takes
+// printf-style format string and arguments. After calling setproctitle()
+// the original main() argv[] array should not be used. By default, the
+// original argv[0] is prepended to the format; this can be disabled by
+// including a '-' as the first character of the format string.
+//
+// This signature and naming is to be compatible with most other Unix
+// implementations of setproctitle().
+void setproctitle(const char* fmt, ...);
+
+// Initialize state needed for setproctitle() on Linux. Pass the argv pointer
+// from main() to setproctitle_init() before calling setproctitle().
+void setproctitle_init(char** main_argv);
+
+#endif // CONTENT_COMMON_SET_PROCESS_TITLE_LINUX_H_
diff --git a/content/content_common.gypi b/content/content_common.gypi
index f35ba7e..93ccbcc 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -97,6 +97,12 @@
'common/message_router.h',
'common/mime_registry_messages.h',
'common/mru_cache.h',
+ 'common/native_web_keyboard_event.h',
+ 'common/native_web_keyboard_event_linux.cc',
+ 'common/native_web_keyboard_event_mac.mm',
+ 'common/native_web_keyboard_event_win.cc',
+ 'common/navigation_gesture.h',
+ 'common/navigation_types.h',
'common/notification_details.cc',
'common/notification_details.h',
'common/notification_observer.h',
@@ -109,6 +115,10 @@
'common/notification_type.h',
'common/p2p_messages.h',
'common/p2p_sockets.h',
+ 'common/page_transition_types.cc',
+ 'common/page_transition_types.h',
+ 'common/page_type.h',
+ 'common/page_zoom.h',
'common/pepper_file_messages.cc',
'common/pepper_file_messages.h',
'common/pepper_messages.cc',
@@ -116,6 +126,10 @@
'common/plugin_carbon_interpose_constants_mac.cc',
'common/plugin_carbon_interpose_constants_mac.h',
'common/plugin_messages.h',
+ 'common/process_watcher.h',
+ 'common/process_watcher_mac.cc',
+ 'common/process_watcher_posix.cc',
+ 'common/process_watcher_win.cc',
'common/property_bag.cc',
'common/property_bag.h',
'common/resource_dispatcher.cc',
@@ -129,10 +143,15 @@
'common/sandbox_init_wrapper_win.cc',
'common/sandbox_mac.h',
'common/sandbox_mac.mm',
+ 'common/sandbox_methods_linux.h',
'common/section_util_win.cc',
'common/section_util_win.h',
'common/serialized_script_value.cc',
'common/serialized_script_value.h',
+ 'common/set_process_title.cc',
+ 'common/set_process_title.h',
+ 'common/set_process_title_linux.cc',
+ 'common/set_process_title_linux.h',
'common/socket_stream.h',
'common/socket_stream_dispatcher.cc',
'common/socket_stream_dispatcher.h',
@@ -154,6 +173,21 @@
['OS=="win"', {
'msvs_guid': '062E9260-304A-4657-A74C-0D3AA1A0A0A4',
}],
+ ['OS=="mac"', {
+ 'sources!': [
+ 'common/process_watcher_posix.cc',
+ ],
+ 'link_settings': {
+ 'mac_bundle_resources': [
+ 'common/common.sb',
+ ],
+ },
+ }],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ 'dependencies': [
+ '../build/linux/system.gyp:gtk',
+ ],
+ }],
],
},
],