| 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" |
| 11 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
| 12 #include "content/public/browser/intents_host.h" | 12 #include "content/public/browser/intents_host.h" |
| 13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "webkit/glue/web_intent_data.h" | 15 #include "webkit/glue/web_intent_data.h" |
| 16 | 16 |
| 17 TabContentsDelegate::TabContentsDelegate() { | 17 TabContentsDelegate::TabContentsDelegate() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 TabContents* TabContentsDelegate::OpenURLFromTab( | |
| 21 TabContents* source, | |
| 22 const GURL& url, | |
| 23 const GURL& referrer, | |
| 24 WindowOpenDisposition disposition, | |
| 25 content::PageTransition transition) { | |
| 26 return OpenURLFromTab(source, | |
| 27 OpenURLParams(url, referrer, disposition, transition, | |
| 28 false)); | |
| 29 } | |
| 30 | |
| 31 TabContents* TabContentsDelegate::OpenURLFromTab(TabContents* source, | 20 TabContents* TabContentsDelegate::OpenURLFromTab(TabContents* source, |
| 32 const OpenURLParams& params) { | 21 const OpenURLParams& params) { |
| 33 return NULL; | 22 return NULL; |
| 34 } | 23 } |
| 35 | 24 |
| 36 void TabContentsDelegate::NavigationStateChanged(const TabContents* source, | 25 void TabContentsDelegate::NavigationStateChanged(const TabContents* source, |
| 37 unsigned changed_flags) { | 26 unsigned changed_flags) { |
| 38 } | 27 } |
| 39 | 28 |
| 40 void TabContentsDelegate::AddNavigationHeaders(const GURL& url, | 29 void TabContentsDelegate::AddNavigationHeaders(const GURL& url, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool show_history) { | 142 bool show_history) { |
| 154 } | 143 } |
| 155 | 144 |
| 156 void TabContentsDelegate::ViewSourceForTab(TabContents* source, | 145 void TabContentsDelegate::ViewSourceForTab(TabContents* source, |
| 157 const GURL& page_url) { | 146 const GURL& page_url) { |
| 158 // Fall back implementation based entirely on the view-source scheme. | 147 // Fall back implementation based entirely on the view-source scheme. |
| 159 // 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 |
| 160 // it with proper implementation. | 149 // it with proper implementation. |
| 161 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 150 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 162 page_url.spec()); | 151 page_url.spec()); |
| 163 OpenURLFromTab(source, | 152 OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), |
| 164 url, | 153 NEW_FOREGROUND_TAB, |
| 165 GURL(), | 154 content::PAGE_TRANSITION_LINK, false)); |
| 166 NEW_FOREGROUND_TAB, | |
| 167 content::PAGE_TRANSITION_LINK); | |
| 168 } | 155 } |
| 169 | 156 |
| 170 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, | 157 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, |
| 171 const GURL& frame_url, | 158 const GURL& frame_url, |
| 172 const std::string& content_state) { | 159 const std::string& content_state) { |
| 173 // Same as ViewSourceForTab, but for given subframe. | 160 // Same as ViewSourceForTab, but for given subframe. |
| 174 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 161 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 175 frame_url.spec()); | 162 frame_url.spec()); |
| 176 OpenURLFromTab(source, | 163 OpenURLFromTab(source, OpenURLParams(url, content::Referrer(), |
| 177 url, | 164 NEW_FOREGROUND_TAB, |
| 178 GURL(), | 165 content::PAGE_TRANSITION_LINK, false)); |
| 179 NEW_FOREGROUND_TAB, | |
| 180 content::PAGE_TRANSITION_LINK); | |
| 181 } | 166 } |
| 182 | 167 |
| 183 bool TabContentsDelegate::PreHandleKeyboardEvent( | 168 bool TabContentsDelegate::PreHandleKeyboardEvent( |
| 184 const NativeWebKeyboardEvent& event, | 169 const NativeWebKeyboardEvent& event, |
| 185 bool* is_keyboard_shortcut) { | 170 bool* is_keyboard_shortcut) { |
| 186 return false; | 171 return false; |
| 187 } | 172 } |
| 188 | 173 |
| 189 void TabContentsDelegate::HandleKeyboardEvent( | 174 void TabContentsDelegate::HandleKeyboardEvent( |
| 190 const NativeWebKeyboardEvent& event) { | 175 const NativeWebKeyboardEvent& event) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 attached_contents_.insert(tab_contents); | 343 attached_contents_.insert(tab_contents); |
| 359 } | 344 } |
| 360 | 345 |
| 361 void TabContentsDelegate::Detach(TabContents* tab_contents) { | 346 void TabContentsDelegate::Detach(TabContents* tab_contents) { |
| 362 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); | 347 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); |
| 363 attached_contents_.erase(tab_contents); | 348 attached_contents_.erase(tab_contents); |
| 364 } | 349 } |
| 365 | 350 |
| 366 void TabContentsDelegate::LostMouseLock() { | 351 void TabContentsDelegate::LostMouseLock() { |
| 367 } | 352 } |
| OLD | NEW |