| 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/intents/web_intent_inline_disposition_delegate.h" | 5 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "chrome/browser/ui/intents/web_intent_picker.h" | 10 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 source->GetController().PruneAllButActive(); | 60 source->GetController().PruneAllButActive(); |
| 61 | 61 |
| 62 return source; | 62 return source; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void WebIntentInlineDispositionDelegate::AddNewContents( | 65 void WebIntentInlineDispositionDelegate::AddNewContents( |
| 66 content::WebContents* source, | 66 content::WebContents* source, |
| 67 content::WebContents* new_contents, | 67 content::WebContents* new_contents, |
| 68 WindowOpenDisposition disposition, | 68 WindowOpenDisposition disposition, |
| 69 const gfx::Rect& initial_pos, | 69 const gfx::Rect& initial_pos, |
| 70 bool user_gesture) { | 70 bool user_gesture, |
| 71 bool* was_blocked) { |
| 71 DCHECK_EQ(source, web_contents_); | 72 DCHECK_EQ(source, web_contents_); |
| 72 DCHECK_EQ(Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 73 DCHECK_EQ(Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
| 73 browser_->profile()); | 74 browser_->profile()); |
| 74 // Force all links to open in a new tab, even when different disposition is | 75 // Force all links to open in a new tab, even when different disposition is |
| 75 // requested. | 76 // requested. |
| 76 disposition = | 77 disposition = |
| 77 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 78 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
| 78 chrome::AddWebContents(browser_, NULL, new_contents, disposition, initial_pos, | 79 chrome::AddWebContents(browser_, NULL, new_contents, disposition, initial_pos, |
| 79 user_gesture); | 80 user_gesture, was_blocked); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void WebIntentInlineDispositionDelegate::LoadingStateChanged( | 83 void WebIntentInlineDispositionDelegate::LoadingStateChanged( |
| 83 content::WebContents* source) { | 84 content::WebContents* source) { |
| 84 if (!source->IsLoading()) | 85 if (!source->IsLoading()) |
| 85 picker_->OnInlineDispositionWebContentsLoaded(source); | 86 picker_->OnInlineDispositionWebContentsLoaded(source); |
| 86 } | 87 } |
| 87 | 88 |
| 88 bool WebIntentInlineDispositionDelegate::OnMessageReceived( | 89 bool WebIntentInlineDispositionDelegate::OnMessageReceived( |
| 89 const IPC::Message& message) { | 90 const IPC::Message& message) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 115 void WebIntentInlineDispositionDelegate::OnRequest( | 116 void WebIntentInlineDispositionDelegate::OnRequest( |
| 116 const ExtensionHostMsg_Request_Params& params) { | 117 const ExtensionHostMsg_Request_Params& params) { |
| 117 extension_function_dispatcher_.Dispatch(params, | 118 extension_function_dispatcher_.Dispatch(params, |
| 118 web_contents_->GetRenderViewHost()); | 119 web_contents_->GetRenderViewHost()); |
| 119 } | 120 } |
| 120 void WebIntentInlineDispositionDelegate::ResizeDueToAutoResize( | 121 void WebIntentInlineDispositionDelegate::ResizeDueToAutoResize( |
| 121 content::WebContents* source, const gfx::Size& pref_size) { | 122 content::WebContents* source, const gfx::Size& pref_size) { |
| 122 DCHECK(picker_); | 123 DCHECK(picker_); |
| 123 picker_->OnInlineDispositionAutoResize(pref_size); | 124 picker_->OnInlineDispositionAutoResize(pref_size); |
| 124 } | 125 } |
| OLD | NEW |