OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_shutdown.h" | 16 #include "chrome/browser/browser_shutdown.h" |
17 #include "chrome/browser/debugger/devtools_manager.h" | 17 #include "chrome/browser/debugger/devtools_manager.h" |
18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
19 #include "chrome/browser/external_protocol_handler.h" | 19 #include "chrome/browser/external_protocol_handler.h" |
20 #include "chrome/browser/history/history.h" | 20 #include "chrome/browser/history/history.h" |
21 #include "chrome/browser/load_from_memory_cache_details.h" | 21 #include "chrome/browser/load_from_memory_cache_details.h" |
22 #include "chrome/browser/load_notification_details.h" | 22 #include "chrome/browser/load_notification_details.h" |
23 #include "chrome/browser/notifications/desktop_notification_service.h" | 23 #include "chrome/browser/notifications/desktop_notification_service.h" |
24 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 24 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
25 #include "chrome/browser/platform_util.h" | |
26 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/renderer_host/web_cache_manager.h" | 27 #include "chrome/browser/renderer_host/web_cache_manager.h" |
29 #include "chrome/browser/renderer_preferences_util.h" | 28 #include "chrome/browser/renderer_preferences_util.h" |
30 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 29 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
31 #include "chrome/browser/ui/browser_dialogs.h" | 30 #include "chrome/browser/ui/browser_dialogs.h" |
32 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
35 #include "content/browser/child_process_security_policy.h" | 34 #include "content/browser/child_process_security_policy.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 child_windows_.erase(i); | 754 child_windows_.erase(i); |
756 if (child_windows_.empty()) { | 755 if (child_windows_.empty()) { |
757 BlockTabContent(false); | 756 BlockTabContent(false); |
758 } else { | 757 } else { |
759 if (removed_topmost_window) | 758 if (removed_topmost_window) |
760 child_windows_[0]->ShowConstrainedWindow(); | 759 child_windows_[0]->ShowConstrainedWindow(); |
761 BlockTabContent(true); | 760 BlockTabContent(true); |
762 } | 761 } |
763 } | 762 } |
764 | 763 |
765 void TabContents::EmailPageLocation() { | |
766 std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); | |
767 std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); | |
768 std::string mailto = std::string("mailto:?subject=Fwd:%20") + | |
769 title + "&body=%0A%0A" + page_url; | |
770 platform_util::OpenExternal(GURL(mailto)); | |
771 } | |
772 | |
773 bool TabContents::IsActiveEntry(int32 page_id) { | 764 bool TabContents::IsActiveEntry(int32 page_id) { |
774 NavigationEntry* active_entry = controller_.GetActiveEntry(); | 765 NavigationEntry* active_entry = controller_.GetActiveEntry(); |
775 return (active_entry != NULL && | 766 return (active_entry != NULL && |
776 active_entry->site_instance() == GetSiteInstance() && | 767 active_entry->site_instance() == GetSiteInstance() && |
777 active_entry->page_id() == page_id); | 768 active_entry->page_id() == page_id); |
778 } | 769 } |
779 | 770 |
780 void TabContents::SetOverrideEncoding(const std::string& encoding) { | 771 void TabContents::SetOverrideEncoding(const std::string& encoding) { |
781 set_encoding(encoding); | 772 set_encoding(encoding); |
782 render_view_host()->Send(new ViewMsg_SetPageEncoding( | 773 render_view_host()->Send(new ViewMsg_SetPageEncoding( |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2053 | 2044 |
2054 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2045 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2055 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2046 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2056 rwh_view->SetSize(view()->GetContainerSize()); | 2047 rwh_view->SetSize(view()->GetContainerSize()); |
2057 } | 2048 } |
2058 | 2049 |
2059 void TabContents::OnOnlineStateChanged(bool online) { | 2050 void TabContents::OnOnlineStateChanged(bool online) { |
2060 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2051 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
2061 render_view_host()->routing_id(), online)); | 2052 render_view_host()->routing_id(), online)); |
2062 } | 2053 } |
OLD | NEW |