| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/tab_contents/core_tab_helper.h" | 5 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/renderer_host/web_cache_manager.h" | |
| 15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_command_controller.h" | 16 #include "chrome/browser/ui/browser_command_controller.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
| 21 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/search_engines/template_url.h" | 21 #include "components/search_engines/template_url.h" |
| 23 #include "components/search_engines/template_url_service.h" | 22 #include "components/search_engines/template_url_service.h" |
| 23 #include "components/web_cache/browser/web_cache_manager.h" |
| 24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "net/base/load_states.h" | 27 #include "net/base/load_states.h" |
| 28 #include "net/http/http_request_headers.h" | 28 #include "net/http/http_request_headers.h" |
| 29 #include "third_party/skia/include/core/SkBitmap.h" | 29 #include "third_party/skia/include/core/SkBitmap.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/gfx/codec/jpeg_codec.h" | 31 #include "ui/gfx/codec/jpeg_codec.h" |
| 32 | 32 |
| 33 using content::WebContents; | 33 using content::WebContents; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 //////////////////////////////////////////////////////////////////////////////// | 140 //////////////////////////////////////////////////////////////////////////////// |
| 141 // WebContentsObserver overrides | 141 // WebContentsObserver overrides |
| 142 | 142 |
| 143 void CoreTabHelper::DidStartLoading(content::RenderViewHost* render_view_host) { | 143 void CoreTabHelper::DidStartLoading(content::RenderViewHost* render_view_host) { |
| 144 UpdateContentRestrictions(0); | 144 UpdateContentRestrictions(0); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void CoreTabHelper::WasShown() { | 147 void CoreTabHelper::WasShown() { |
| 148 WebCacheManager::GetInstance()->ObserveActivity( | 148 web_cache::WebCacheManager::GetInstance()->ObserveActivity( |
| 149 web_contents()->GetRenderProcessHost()->GetID()); | 149 web_contents()->GetRenderProcessHost()->GetID()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void CoreTabHelper::WebContentsDestroyed() { | 152 void CoreTabHelper::WebContentsDestroyed() { |
| 153 // OnCloseStarted isn't called in unit tests. | 153 // OnCloseStarted isn't called in unit tests. |
| 154 if (!close_start_time_.is_null()) { | 154 if (!close_start_time_.is_null()) { |
| 155 bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 155 bool fast_tab_close_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
| 156 switches::kEnableFastUnload); | 156 switches::kEnableFastUnload); |
| 157 | 157 |
| 158 if (fast_tab_close_enabled) { | 158 if (fast_tab_close_enabled) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 DCHECK(!content_type.empty()); | 249 DCHECK(!content_type.empty()); |
| 250 open_url_params.uses_post = true; | 250 open_url_params.uses_post = true; |
| 251 open_url_params.browser_initiated_post_data = | 251 open_url_params.browser_initiated_post_data = |
| 252 base::RefCountedString::TakeString(post_data); | 252 base::RefCountedString::TakeString(post_data); |
| 253 open_url_params.extra_headers += base::StringPrintf( | 253 open_url_params.extra_headers += base::StringPrintf( |
| 254 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, | 254 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, |
| 255 content_type.c_str()); | 255 content_type.c_str()); |
| 256 } | 256 } |
| 257 web_contents()->OpenURL(open_url_params); | 257 web_contents()->OpenURL(open_url_params); |
| 258 } | 258 } |
| OLD | NEW |