| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3044 window()->ConfirmAddSearchProvider(template_url, profile); | 3044 window()->ConfirmAddSearchProvider(template_url, profile); |
| 3045 } | 3045 } |
| 3046 | 3046 |
| 3047 void Browser::ShowPageInfo(Profile* profile, | 3047 void Browser::ShowPageInfo(Profile* profile, |
| 3048 const GURL& url, | 3048 const GURL& url, |
| 3049 const NavigationEntry::SSLStatus& ssl, | 3049 const NavigationEntry::SSLStatus& ssl, |
| 3050 bool show_history) { | 3050 bool show_history) { |
| 3051 window()->ShowPageInfo(profile, url, ssl, show_history); | 3051 window()->ShowPageInfo(profile, url, ssl, show_history); |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 void Browser::ViewSourceForTab(TabContents* contents) { | 3054 void Browser::ViewSourceForTab(TabContents* source, const GURL& page_url) { |
| 3055 DCHECK(contents); | 3055 DCHECK(source); |
| 3056 int index = tabstrip_model()->GetWrapperIndex(contents); | 3056 int index = tabstrip_model()->GetWrapperIndex(source); |
| 3057 TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index); | 3057 TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index); |
| 3058 ViewSource(wrapper); | 3058 ViewSource(wrapper); |
| 3059 } | 3059 } |
| 3060 | 3060 |
| 3061 bool Browser::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 3061 bool Browser::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 3062 bool* is_keyboard_shortcut) { | 3062 bool* is_keyboard_shortcut) { |
| 3063 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); | 3063 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); |
| 3064 } | 3064 } |
| 3065 | 3065 |
| 3066 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 3066 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 } | 4126 } |
| 4127 | 4127 |
| 4128 void Browser::ViewSource(TabContentsWrapper* contents) { | 4128 void Browser::ViewSource(TabContentsWrapper* contents) { |
| 4129 UserMetrics::RecordAction(UserMetricsAction("ViewSource"), profile_); | 4129 UserMetrics::RecordAction(UserMetricsAction("ViewSource"), profile_); |
| 4130 DCHECK(contents); | 4130 DCHECK(contents); |
| 4131 | 4131 |
| 4132 TabContentsWrapper* view_source_contents = contents->Clone(); | 4132 TabContentsWrapper* view_source_contents = contents->Clone(); |
| 4133 view_source_contents->controller().PruneAllButActive(); | 4133 view_source_contents->controller().PruneAllButActive(); |
| 4134 NavigationEntry* active_entry = | 4134 NavigationEntry* active_entry = |
| 4135 view_source_contents->controller().GetActiveEntry(); | 4135 view_source_contents->controller().GetActiveEntry(); |
| 4136 if (!active_entry) |
| 4137 return; |
| 4138 |
| 4136 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 4139 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 4137 active_entry->url().spec()); | 4140 active_entry->url().spec()); |
| 4138 active_entry->set_virtual_url(url); | 4141 active_entry->set_virtual_url(url); |
| 4139 InsertContentsDupe(contents, view_source_contents); | 4142 InsertContentsDupe(contents, view_source_contents); |
| 4140 } | 4143 } |
| 4141 | 4144 |
| 4142 void Browser::InsertContentsDupe( | 4145 void Browser::InsertContentsDupe( |
| 4143 TabContentsWrapper* contents, | 4146 TabContentsWrapper* contents, |
| 4144 TabContentsWrapper* contents_dupe) { | 4147 TabContentsWrapper* contents_dupe) { |
| 4145 DCHECK(contents); | 4148 DCHECK(contents); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4183 // The page transition below is only for the purpose of inserting the tab. | 4186 // The page transition below is only for the purpose of inserting the tab. |
| 4184 browser->AddTab(contents_dupe, PageTransition::LINK); | 4187 browser->AddTab(contents_dupe, PageTransition::LINK); |
| 4185 } | 4188 } |
| 4186 | 4189 |
| 4187 if (profile_->HasSessionService()) { | 4190 if (profile_->HasSessionService()) { |
| 4188 SessionService* session_service = profile_->GetSessionService(); | 4191 SessionService* session_service = profile_->GetSessionService(); |
| 4189 if (session_service) | 4192 if (session_service) |
| 4190 session_service->TabRestored(&new_contents->controller(), pinned); | 4193 session_service->TabRestored(&new_contents->controller(), pinned); |
| 4191 } | 4194 } |
| 4192 } | 4195 } |
| OLD | NEW |