| 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" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_intents_dispatcher.h" | |
| 13 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
| 14 #include "content/public/common/bindings_policy.h" | 13 #include "content/public/common/bindings_policy.h" |
| 15 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 16 #include "webkit/glue/web_intent_data.h" | |
| 17 | 15 |
| 18 namespace content { | 16 namespace content { |
| 19 | 17 |
| 20 WebContentsDelegate::WebContentsDelegate() { | 18 WebContentsDelegate::WebContentsDelegate() { |
| 21 } | 19 } |
| 22 | 20 |
| 23 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, | 21 WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, |
| 24 const OpenURLParams& params) { | 22 const OpenURLParams& params) { |
| 25 return NULL; | 23 return NULL; |
| 26 } | 24 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return false; | 128 return false; |
| 131 } | 129 } |
| 132 | 130 |
| 133 content::ColorChooser* WebContentsDelegate::OpenColorChooser( | 131 content::ColorChooser* WebContentsDelegate::OpenColorChooser( |
| 134 WebContents* web_contents, | 132 WebContents* web_contents, |
| 135 int color_chooser_id, | 133 int color_chooser_id, |
| 136 SkColor color) { | 134 SkColor color) { |
| 137 return NULL; | 135 return NULL; |
| 138 } | 136 } |
| 139 | 137 |
| 140 void WebContentsDelegate::WebIntentDispatch( | |
| 141 WebContents* web_contents, | |
| 142 WebIntentsDispatcher* intents_dispatcher) { | |
| 143 // The caller passes this method ownership of the |intents_dispatcher|, but | |
| 144 // this empty implementation will not use it, so we delete it immediately. | |
| 145 delete intents_dispatcher; | |
| 146 } | |
| 147 | |
| 148 bool WebContentsDelegate::RequestPpapiBrokerPermission( | 138 bool WebContentsDelegate::RequestPpapiBrokerPermission( |
| 149 WebContents* web_contents, | 139 WebContents* web_contents, |
| 150 const GURL& url, | 140 const GURL& url, |
| 151 const FilePath& plugin_path, | 141 const FilePath& plugin_path, |
| 152 const base::Callback<void(bool)>& callback) { | 142 const base::Callback<void(bool)>& callback) { |
| 153 return false; | 143 return false; |
| 154 } | 144 } |
| 155 | 145 |
| 156 WebContentsDelegate::~WebContentsDelegate() { | 146 WebContentsDelegate::~WebContentsDelegate() { |
| 157 while (!attached_contents_.empty()) { | 147 while (!attached_contents_.empty()) { |
| 158 WebContents* web_contents = *attached_contents_.begin(); | 148 WebContents* web_contents = *attached_contents_.begin(); |
| 159 web_contents->SetDelegate(NULL); | 149 web_contents->SetDelegate(NULL); |
| 160 } | 150 } |
| 161 DCHECK(attached_contents_.empty()); | 151 DCHECK(attached_contents_.empty()); |
| 162 } | 152 } |
| 163 | 153 |
| 164 void WebContentsDelegate::Attach(WebContents* web_contents) { | 154 void WebContentsDelegate::Attach(WebContents* web_contents) { |
| 165 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); | 155 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); |
| 166 attached_contents_.insert(web_contents); | 156 attached_contents_.insert(web_contents); |
| 167 } | 157 } |
| 168 | 158 |
| 169 void WebContentsDelegate::Detach(WebContents* web_contents) { | 159 void WebContentsDelegate::Detach(WebContents* web_contents) { |
| 170 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); | 160 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); |
| 171 attached_contents_.erase(web_contents); | 161 attached_contents_.erase(web_contents); |
| 172 } | 162 } |
| 173 | 163 |
| 174 } // namespace content | 164 } // namespace content |
| OLD | NEW |