| 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_delegate.h" | 5 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "content/browser/javascript_dialogs.h" | 10 #include "content/browser/javascript_dialogs.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 bool show_history) { | 142 bool show_history) { |
| 143 } | 143 } |
| 144 | 144 |
| 145 void TabContentsDelegate::ViewSourceForTab(TabContents* source, | 145 void TabContentsDelegate::ViewSourceForTab(TabContents* source, |
| 146 const GURL& page_url) { | 146 const GURL& page_url) { |
| 147 // Fall back implementation based entirely on the view-source scheme. | 147 // Fall back implementation based entirely on the view-source scheme. |
| 148 // It suffers from http://crbug.com/523 and that is why browser overrides | 148 // It suffers from http://crbug.com/523 and that is why browser overrides |
| 149 // it with proper implementation. | 149 // it with proper implementation. |
| 150 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 150 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 151 page_url.spec()); | 151 page_url.spec()); |
| 152 OpenURLFromTab(source, OpenURLParams( | 152 OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), |
| 153 url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 153 NEW_FOREGROUND_TAB, |
| 154 content::PAGE_TRANSITION_LINK, false)); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, | 157 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, |
| 157 const GURL& frame_url, | 158 const GURL& frame_url, |
| 158 const std::string& content_state) { | 159 const std::string& content_state) { |
| 159 // Same as ViewSourceForTab, but for given subframe. | 160 // Same as ViewSourceForTab, but for given subframe. |
| 160 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 161 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 161 frame_url.spec()); | 162 frame_url.spec()); |
| 162 OpenURLFromTab(source, OpenURLParams( | 163 OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), |
| 163 url, GURL(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 164 NEW_FOREGROUND_TAB, |
| 165 content::PAGE_TRANSITION_LINK, false)); |
| 164 } | 166 } |
| 165 | 167 |
| 166 bool TabContentsDelegate::PreHandleKeyboardEvent( | 168 bool TabContentsDelegate::PreHandleKeyboardEvent( |
| 167 const NativeWebKeyboardEvent& event, | 169 const NativeWebKeyboardEvent& event, |
| 168 bool* is_keyboard_shortcut) { | 170 bool* is_keyboard_shortcut) { |
| 169 return false; | 171 return false; |
| 170 } | 172 } |
| 171 | 173 |
| 172 void TabContentsDelegate::HandleKeyboardEvent( | 174 void TabContentsDelegate::HandleKeyboardEvent( |
| 173 const NativeWebKeyboardEvent& event) { | 175 const NativeWebKeyboardEvent& event) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 attached_contents_.insert(tab_contents); | 343 attached_contents_.insert(tab_contents); |
| 342 } | 344 } |
| 343 | 345 |
| 344 void TabContentsDelegate::Detach(TabContents* tab_contents) { | 346 void TabContentsDelegate::Detach(TabContents* tab_contents) { |
| 345 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); | 347 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); |
| 346 attached_contents_.erase(tab_contents); | 348 attached_contents_.erase(tab_contents); |
| 347 } | 349 } |
| 348 | 350 |
| 349 void TabContentsDelegate::LostMouseLock() { | 351 void TabContentsDelegate::LostMouseLock() { |
| 350 } | 352 } |
| OLD | NEW |