| 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/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() { | 126 JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() { |
| 127 return NULL; | 127 return NULL; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool WebContentsDelegate::IsFullscreenForTab(const WebContents* tab) const { | 130 bool WebContentsDelegate::IsFullscreenForTab(const WebContents* tab) const { |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 content::ColorChooser* WebContentsDelegate::OpenColorChooser(WebContents* tab, |
| 135 int color_chooser_id, |
| 136 const SkColor& color) { |
| 137 return NULL; |
| 138 } |
| 139 |
| 134 void WebContentsDelegate::WebIntentDispatch( | 140 void WebContentsDelegate::WebIntentDispatch( |
| 135 WebContents* tab, | 141 WebContents* tab, |
| 136 WebIntentsDispatcher* intents_dispatcher) { | 142 WebIntentsDispatcher* intents_dispatcher) { |
| 137 // The caller passes this method ownership of the |intents_dispatcher|, but | 143 // The caller passes this method ownership of the |intents_dispatcher|, but |
| 138 // this empty implementation will not use it, so we delete it immediately. | 144 // this empty implementation will not use it, so we delete it immediately. |
| 139 delete intents_dispatcher; | 145 delete intents_dispatcher; |
| 140 } | 146 } |
| 141 | 147 |
| 142 WebContentsDelegate::~WebContentsDelegate() { | 148 WebContentsDelegate::~WebContentsDelegate() { |
| 143 while (!attached_contents_.empty()) { | 149 while (!attached_contents_.empty()) { |
| 144 WebContents* web_contents = *attached_contents_.begin(); | 150 WebContents* web_contents = *attached_contents_.begin(); |
| 145 web_contents->SetDelegate(NULL); | 151 web_contents->SetDelegate(NULL); |
| 146 } | 152 } |
| 147 DCHECK(attached_contents_.empty()); | 153 DCHECK(attached_contents_.empty()); |
| 148 } | 154 } |
| 149 | 155 |
| 150 void WebContentsDelegate::Attach(WebContents* web_contents) { | 156 void WebContentsDelegate::Attach(WebContents* web_contents) { |
| 151 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); | 157 DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); |
| 152 attached_contents_.insert(web_contents); | 158 attached_contents_.insert(web_contents); |
| 153 } | 159 } |
| 154 | 160 |
| 155 void WebContentsDelegate::Detach(WebContents* web_contents) { | 161 void WebContentsDelegate::Detach(WebContents* web_contents) { |
| 156 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); | 162 DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); |
| 157 attached_contents_.erase(web_contents); | 163 attached_contents_.erase(web_contents); |
| 158 } | 164 } |
| 159 | 165 |
| 160 } // namespace content | 166 } // namespace content |
| OLD | NEW |