| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 #if defined(OS_WIN) | 173 #if defined(OS_WIN) |
| 174 | 174 |
| 175 BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { | 175 BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { |
| 176 // Note: erase is required to properly paint some widgets borders. This can | 176 // Note: erase is required to properly paint some widgets borders. This can |
| 177 // be seen with textfields. | 177 // be seen with textfields. |
| 178 InvalidateRect(hwnd, NULL, TRUE); | 178 InvalidateRect(hwnd, NULL, TRUE); |
| 179 return TRUE; | 179 return TRUE; |
| 180 } | 180 } |
| 181 #endif | 181 #endif |
| 182 | 182 |
| 183 void MakeNavigateParams(const NavigationEntry& entry, bool reload, | 183 ViewMsg_Navigate_Params::NavigationType GetNavigationType( |
| 184 ViewMsg_Navigate_Params* params) { | 184 Profile* profile, const NavigationEntry& entry, bool reload) { |
| 185 if (reload) |
| 186 return ViewMsg_Navigate_Params::RELOAD; |
| 187 |
| 188 if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION && |
| 189 profile->DidLastSessionExitCleanly()) |
| 190 return ViewMsg_Navigate_Params::RESTORE; |
| 191 |
| 192 return ViewMsg_Navigate_Params::NORMAL; |
| 193 } |
| 194 |
| 195 void MakeNavigateParams(Profile* profile, const NavigationEntry& entry, |
| 196 bool reload, ViewMsg_Navigate_Params* params) { |
| 185 params->page_id = entry.page_id(); | 197 params->page_id = entry.page_id(); |
| 186 params->url = entry.url(); | 198 params->url = entry.url(); |
| 187 params->referrer = entry.referrer(); | 199 params->referrer = entry.referrer(); |
| 188 params->transition = entry.transition_type(); | 200 params->transition = entry.transition_type(); |
| 189 params->state = entry.content_state(); | 201 params->state = entry.content_state(); |
| 190 params->reload = reload; | 202 params->navigation_type = GetNavigationType(profile, entry, reload); |
| 191 params->request_time = base::Time::Now(); | 203 params->request_time = base::Time::Now(); |
| 192 } | 204 } |
| 193 | 205 |
| 194 } // namespace | 206 } // namespace |
| 195 | 207 |
| 196 // ----------------------------------------------------------------------------- | 208 // ----------------------------------------------------------------------------- |
| 197 | 209 |
| 198 // static | 210 // static |
| 199 int TabContents::find_request_id_counter_ = -1; | 211 int TabContents::find_request_id_counter_ = -1; |
| 200 | 212 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 render_view_host(), | 698 render_view_host(), |
| 687 dest_render_view_host, | 699 dest_render_view_host, |
| 688 controller_.pending_entry()->url()); | 700 controller_.pending_entry()->url()); |
| 689 } | 701 } |
| 690 | 702 |
| 691 // Used for page load time metrics. | 703 // Used for page load time metrics. |
| 692 current_load_start_ = base::TimeTicks::Now(); | 704 current_load_start_ = base::TimeTicks::Now(); |
| 693 | 705 |
| 694 // Navigate in the desired RenderViewHost. | 706 // Navigate in the desired RenderViewHost. |
| 695 ViewMsg_Navigate_Params navigate_params; | 707 ViewMsg_Navigate_Params navigate_params; |
| 696 MakeNavigateParams(entry, reload, &navigate_params); | 708 MakeNavigateParams(profile(), entry, reload, &navigate_params); |
| 697 dest_render_view_host->Navigate(navigate_params); | 709 dest_render_view_host->Navigate(navigate_params); |
| 698 | 710 |
| 699 if (entry.page_id() == -1) { | 711 if (entry.page_id() == -1) { |
| 700 // HACK!! This code suppresses javascript: URLs from being added to | 712 // HACK!! This code suppresses javascript: URLs from being added to |
| 701 // session history, which is what we want to do for javascript: URLs that | 713 // session history, which is what we want to do for javascript: URLs that |
| 702 // do not generate content. What we really need is a message from the | 714 // do not generate content. What we really need is a message from the |
| 703 // renderer telling us that a new page was not created. The same message | 715 // renderer telling us that a new page was not created. The same message |
| 704 // could be used for mailto: URLs and the like. | 716 // could be used for mailto: URLs and the like. |
| 705 if (entry.url().SchemeIs(chrome::kJavaScriptScheme)) | 717 if (entry.url().SchemeIs(chrome::kJavaScriptScheme)) |
| 706 return false; | 718 return false; |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 #endif | 2644 #endif |
| 2633 | 2645 |
| 2634 default: | 2646 default: |
| 2635 NOTREACHED(); | 2647 NOTREACHED(); |
| 2636 } | 2648 } |
| 2637 } | 2649 } |
| 2638 | 2650 |
| 2639 void TabContents::set_encoding(const std::string& encoding) { | 2651 void TabContents::set_encoding(const std::string& encoding) { |
| 2640 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2652 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2641 } | 2653 } |
| OLD | NEW |