| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "content/public/browser/web_contents.h" | |
| 9 | |
| 10 using content::BrowserContext; | |
| 11 using content::OpenURLParams; | |
| 12 using content::WebContents; | |
| 13 | |
| 14 // Incognito profiles are not long-lived, so we always want to store a | |
| 15 // non-incognito profile. | |
| 16 // | |
| 17 // TODO(akalin): Should we make it so that we have a default incognito | |
| 18 // profile that's long-lived? Of course, we'd still have to clear it out | |
| 19 // when all incognito browsers close. | |
| 20 WebDialogWebContentsDelegate::WebDialogWebContentsDelegate( | |
| 21 content::BrowserContext* browser_context, | |
| 22 WebContentsHandler* handler) | |
| 23 : browser_context_(browser_context), | |
| 24 handler_(handler) { | |
| 25 CHECK(handler_.get()); | |
| 26 } | |
| 27 | |
| 28 WebDialogWebContentsDelegate::~WebDialogWebContentsDelegate() { | |
| 29 } | |
| 30 | |
| 31 void WebDialogWebContentsDelegate::Detach() { | |
| 32 browser_context_ = NULL; | |
| 33 } | |
| 34 | |
| 35 WebContents* WebDialogWebContentsDelegate::OpenURLFromTab( | |
| 36 WebContents* source, const OpenURLParams& params) { | |
| 37 return handler_->OpenURLFromTab(browser_context_, source, params); | |
| 38 } | |
| 39 | |
| 40 void WebDialogWebContentsDelegate::AddNewContents( | |
| 41 WebContents* source, WebContents* new_contents, | |
| 42 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, | |
| 43 bool user_gesture) { | |
| 44 handler_->AddNewContents(browser_context_, source, new_contents, disposition, | |
| 45 initial_pos, user_gesture); | |
| 46 } | |
| 47 | |
| 48 bool WebDialogWebContentsDelegate::IsPopupOrPanel( | |
| 49 const WebContents* source) const { | |
| 50 // This needs to return true so that we are allowed to be resized by our | |
| 51 // contents. | |
| 52 return true; | |
| 53 } | |
| 54 | |
| 55 bool WebDialogWebContentsDelegate::ShouldAddNavigationToHistory( | |
| 56 const history::HistoryAddPageArgs& add_page_args, | |
| 57 content::NavigationType navigation_type) { | |
| 58 return false; | |
| 59 } | |
| OLD | NEW |