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/common/url_constants.h" | 12 #include "content/common/url_constants.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 #include "webkit/glue/web_intent_data.h" | 14 #include "webkit/glue/web_intent_data.h" |
15 | 15 |
16 TabContentsDelegate::TabContentsDelegate() { | 16 TabContentsDelegate::TabContentsDelegate() { |
17 } | 17 } |
18 | 18 |
19 TabContents* TabContentsDelegate::OpenURLFromTab( | 19 TabContents* TabContentsDelegate::OpenURLFromTab( |
20 TabContents* source, | 20 TabContents* source, |
21 const GURL& url, | 21 const GURL& url, |
22 const GURL& referrer, | 22 const GURL& referrer, |
23 WindowOpenDisposition disposition, | 23 WindowOpenDisposition disposition, |
24 PageTransition::Type transition) { | 24 content::PageTransition transition) { |
25 return OpenURLFromTab(source, | 25 return OpenURLFromTab(source, |
26 OpenURLParams(url, referrer, disposition, transition)); | 26 OpenURLParams(url, referrer, disposition, transition)); |
27 } | 27 } |
28 | 28 |
29 TabContents* TabContentsDelegate::OpenURLFromTab(TabContents* source, | 29 TabContents* TabContentsDelegate::OpenURLFromTab(TabContents* source, |
30 const OpenURLParams& params) { | 30 const OpenURLParams& params) { |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 | 33 |
34 void TabContentsDelegate::NavigationStateChanged(const TabContents* source, | 34 void TabContentsDelegate::NavigationStateChanged(const TabContents* source, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 const GURL& page_url) { | 152 const GURL& page_url) { |
153 // Fall back implementation based entirely on the view-source scheme. | 153 // Fall back implementation based entirely on the view-source scheme. |
154 // It suffers from http://crbug.com/523 and that is why browser overrides | 154 // It suffers from http://crbug.com/523 and that is why browser overrides |
155 // it with proper implementation. | 155 // it with proper implementation. |
156 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 156 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
157 page_url.spec()); | 157 page_url.spec()); |
158 OpenURLFromTab(source, | 158 OpenURLFromTab(source, |
159 url, | 159 url, |
160 GURL(), | 160 GURL(), |
161 NEW_FOREGROUND_TAB, | 161 NEW_FOREGROUND_TAB, |
162 PageTransition::LINK); | 162 content::PAGE_TRANSITION_LINK); |
163 } | 163 } |
164 | 164 |
165 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, | 165 void TabContentsDelegate::ViewSourceForFrame(TabContents* source, |
166 const GURL& frame_url, | 166 const GURL& frame_url, |
167 const std::string& content_state) { | 167 const std::string& content_state) { |
168 // Same as ViewSourceForTab, but for given subframe. | 168 // Same as ViewSourceForTab, but for given subframe. |
169 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 169 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
170 frame_url.spec()); | 170 frame_url.spec()); |
171 OpenURLFromTab(source, | 171 OpenURLFromTab(source, |
172 url, | 172 url, |
173 GURL(), | 173 GURL(), |
174 NEW_FOREGROUND_TAB, | 174 NEW_FOREGROUND_TAB, |
175 PageTransition::LINK); | 175 content::PAGE_TRANSITION_LINK); |
176 } | 176 } |
177 | 177 |
178 bool TabContentsDelegate::PreHandleKeyboardEvent( | 178 bool TabContentsDelegate::PreHandleKeyboardEvent( |
179 const NativeWebKeyboardEvent& event, | 179 const NativeWebKeyboardEvent& event, |
180 bool* is_keyboard_shortcut) { | 180 bool* is_keyboard_shortcut) { |
181 return false; | 181 return false; |
182 } | 182 } |
183 | 183 |
184 void TabContentsDelegate::HandleKeyboardEvent( | 184 void TabContentsDelegate::HandleKeyboardEvent( |
185 const NativeWebKeyboardEvent& event) { | 185 const NativeWebKeyboardEvent& event) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 void TabContentsDelegate::Attach(TabContents* tab_contents) { | 337 void TabContentsDelegate::Attach(TabContents* tab_contents) { |
338 DCHECK(attached_contents_.find(tab_contents) == attached_contents_.end()); | 338 DCHECK(attached_contents_.find(tab_contents) == attached_contents_.end()); |
339 attached_contents_.insert(tab_contents); | 339 attached_contents_.insert(tab_contents); |
340 } | 340 } |
341 | 341 |
342 void TabContentsDelegate::Detach(TabContents* tab_contents) { | 342 void TabContentsDelegate::Detach(TabContents* tab_contents) { |
343 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); | 343 DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); |
344 attached_contents_.erase(tab_contents); | 344 attached_contents_.erase(tab_contents); |
345 } | 345 } |
OLD | NEW |