| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/intents/web_intent_picker_factory_impl.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/ui/intents/web_intent_picker.h" | |
| 9 | |
| 10 WebIntentPickerFactoryImpl::WebIntentPickerFactoryImpl() | |
| 11 : picker_(NULL) { | |
| 12 } | |
| 13 | |
| 14 WebIntentPickerFactoryImpl::~WebIntentPickerFactoryImpl() { | |
| 15 Close(); | |
| 16 } | |
| 17 | |
| 18 WebIntentPicker* WebIntentPickerFactoryImpl::Create( | |
| 19 Browser* browser, | |
| 20 TabContentsWrapper* wrapper, | |
| 21 WebIntentPickerDelegate* delegate) { | |
| 22 // Only allow one picker per factory. | |
| 23 DCHECK(picker_ == NULL); | |
| 24 | |
| 25 picker_ = WebIntentPicker::Create(browser, wrapper, delegate); | |
| 26 return picker_; | |
| 27 } | |
| 28 | |
| 29 void WebIntentPickerFactoryImpl::ClosePicker(WebIntentPicker* picker) { | |
| 30 DCHECK(picker == picker_); | |
| 31 Close(); | |
| 32 } | |
| 33 | |
| 34 void WebIntentPickerFactoryImpl::Close() { | |
| 35 if (picker_) { | |
| 36 picker_->Close(); | |
| 37 picker_ = NULL; | |
| 38 } | |
| 39 } | |
| OLD | NEW |