| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/browser/web_contents_delegate.h" | 5 #include "content/public/browser/web_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/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 int request_id, | 69 int request_id, |
| 70 const std::string& request_method) { | 70 const std::string& request_method) { |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool WebContentsDelegate::HandleContextMenu( | 74 bool WebContentsDelegate::HandleContextMenu( |
| 75 const content::ContextMenuParams& params) { | 75 const content::ContextMenuParams& params) { |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool WebContentsDelegate::ExecuteContextMenuCommand(int command) { | |
| 80 return false; | |
| 81 } | |
| 82 | |
| 83 void WebContentsDelegate::ViewSourceForTab(WebContents* source, | 79 void WebContentsDelegate::ViewSourceForTab(WebContents* source, |
| 84 const GURL& page_url) { | 80 const GURL& page_url) { |
| 85 // Fall back implementation based entirely on the view-source scheme. | 81 // Fall back implementation based entirely on the view-source scheme. |
| 86 // It suffers from http://crbug.com/523 and that is why browser overrides | 82 // It suffers from http://crbug.com/523 and that is why browser overrides |
| 87 // it with proper implementation. | 83 // it with proper implementation. |
| 88 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + | 84 GURL url = GURL(chrome::kViewSourceScheme + std::string(":") + |
| 89 page_url.spec()); | 85 page_url.spec()); |
| 90 OpenURLFromTab(source, OpenURLParams(url, Referrer(), | 86 OpenURLFromTab(source, OpenURLParams(url, Referrer(), |
| 91 NEW_FOREGROUND_TAB, | 87 NEW_FOREGROUND_TAB, |
| 92 PAGE_TRANSITION_LINK, false)); | 88 PAGE_TRANSITION_LINK, false)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 107 WebContents* source, | 103 WebContents* source, |
| 108 const NativeWebKeyboardEvent& event, | 104 const NativeWebKeyboardEvent& event, |
| 109 bool* is_keyboard_shortcut) { | 105 bool* is_keyboard_shortcut) { |
| 110 return false; | 106 return false; |
| 111 } | 107 } |
| 112 | 108 |
| 113 bool WebContentsDelegate::OnGoToEntryOffset(int offset) { | 109 bool WebContentsDelegate::OnGoToEntryOffset(int offset) { |
| 114 return true; | 110 return true; |
| 115 } | 111 } |
| 116 | 112 |
| 117 gfx::NativeWindow WebContentsDelegate::GetFrameNativeWindow() { | |
| 118 return NULL; | |
| 119 } | |
| 120 | |
| 121 bool WebContentsDelegate::ShouldCreateWebContents( | 113 bool WebContentsDelegate::ShouldCreateWebContents( |
| 122 WebContents* web_contents, | 114 WebContents* web_contents, |
| 123 int route_id, | 115 int route_id, |
| 124 WindowContainerType window_container_type, | 116 WindowContainerType window_container_type, |
| 125 const string16& frame_name, | 117 const string16& frame_name, |
| 126 const GURL& target_url) { | 118 const GURL& target_url) { |
| 127 return true; | 119 return true; |
| 128 } | 120 } |
| 129 | 121 |
| 130 #if defined(OS_ANDROID) | 122 #if defined(OS_ANDROID) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); | 161 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); |
| 170 attached_contents_.insert(web_contents); | 162 attached_contents_.insert(web_contents); |
| 171 } | 163 } |
| 172 | 164 |
| 173 void WebContentsDelegate::Detach(WebContents* web_contents) { | 165 void WebContentsDelegate::Detach(WebContents* web_contents) { |
| 174 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); | 166 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); |
| 175 attached_contents_.erase(web_contents); | 167 attached_contents_.erase(web_contents); |
| 176 } | 168 } |
| 177 | 169 |
| 178 } // namespace content | 170 } // namespace content |
| OLD | NEW |