| 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 "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" | 5 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_navigator.h" | 9 #include "chrome/browser/ui/browser_navigator.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 | 13 |
| 14 using content::OpenURLParams; | 14 using content::OpenURLParams; |
| 15 using content::WebContents; | 15 using content::WebContents; |
| 16 | 16 |
| 17 // Incognito profiles are not long-lived, so we always want to store a | 17 // Incognito profiles are not long-lived, so we always want to store a |
| 18 // non-incognito profile. | 18 // non-incognito profile. |
| 19 // | 19 // |
| 20 // TODO(akalin): Should we make it so that we have a default incognito | 20 // TODO(akalin): Should we make it so that we have a default incognito |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 WindowOpenDisposition disposition, | 84 WindowOpenDisposition disposition, |
| 85 const gfx::Rect& initial_pos, | 85 const gfx::Rect& initial_pos, |
| 86 bool user_gesture) { | 86 bool user_gesture) { |
| 87 if (!profile) | 87 if (!profile) |
| 88 return NULL; | 88 return NULL; |
| 89 | 89 |
| 90 // Specify a NULL browser for navigation. This will cause Navigate() | 90 // Specify a NULL browser for navigation. This will cause Navigate() |
| 91 // to find a browser matching params.profile or create a new one. | 91 // to find a browser matching params.profile or create a new one. |
| 92 Browser* browser = NULL; | 92 Browser* browser = NULL; |
| 93 | 93 |
| 94 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); | 94 TabContents* tab_contents = new TabContents(new_contents); |
| 95 browser::NavigateParams params(browser, wrapper); | 95 browser::NavigateParams params(browser, tab_contents); |
| 96 params.profile = profile; | 96 params.profile = profile; |
| 97 // TODO(pinkerton): no way to get a wrapper for this. | 97 // TODO(pinkerton): no way to get a TabContents for this. |
| 98 // params.source_contents = source; | 98 // params.source_contents = source; |
| 99 params.disposition = disposition; | 99 params.disposition = disposition; |
| 100 params.window_bounds = initial_pos; | 100 params.window_bounds = initial_pos; |
| 101 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 101 params.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 102 params.user_gesture = true; | 102 params.user_gesture = true; |
| 103 browser::Navigate(¶ms); | 103 browser::Navigate(¶ms); |
| 104 | 104 |
| 105 return params.browser; | 105 return params.browser; |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool WebDialogWebContentsDelegate::IsPopupOrPanel( | 108 bool WebDialogWebContentsDelegate::IsPopupOrPanel( |
| 109 const WebContents* source) const { | 109 const WebContents* source) const { |
| 110 // This needs to return true so that we are allowed to be resized by our | 110 // This needs to return true so that we are allowed to be resized by our |
| 111 // contents. | 111 // contents. |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool WebDialogWebContentsDelegate::ShouldAddNavigationToHistory( | 115 bool WebDialogWebContentsDelegate::ShouldAddNavigationToHistory( |
| 116 const history::HistoryAddPageArgs& add_page_args, | 116 const history::HistoryAddPageArgs& add_page_args, |
| 117 content::NavigationType navigation_type) { | 117 content::NavigationType navigation_type) { |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| OLD | NEW |