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/intents/web_intent_picker.h" |
8 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
10 | 11 |
11 WebIntentInlineDispositionDelegate::WebIntentInlineDispositionDelegate() { | 12 WebIntentInlineDispositionDelegate::WebIntentInlineDispositionDelegate( |
| 13 WebIntentPicker* picker) |
| 14 : picker_(picker) { |
12 } | 15 } |
13 | 16 |
14 WebIntentInlineDispositionDelegate::~WebIntentInlineDispositionDelegate() { | 17 WebIntentInlineDispositionDelegate::~WebIntentInlineDispositionDelegate() { |
15 } | 18 } |
16 | 19 |
17 bool WebIntentInlineDispositionDelegate::IsPopupOrPanel( | 20 bool WebIntentInlineDispositionDelegate::IsPopupOrPanel( |
18 const content::WebContents* source) const { | 21 const content::WebContents* source) const { |
19 return true; | 22 return true; |
20 } | 23 } |
21 | 24 |
22 bool WebIntentInlineDispositionDelegate::ShouldAddNavigationToHistory( | 25 bool WebIntentInlineDispositionDelegate::ShouldAddNavigationToHistory( |
23 const history::HistoryAddPageArgs& add_page_args, | 26 const history::HistoryAddPageArgs& add_page_args, |
24 content::NavigationType navigation_type) { | 27 content::NavigationType navigation_type) { |
25 return false; | 28 return false; |
26 } | 29 } |
27 | 30 |
28 content::WebContents* WebIntentInlineDispositionDelegate::OpenURLFromTab( | 31 content::WebContents* WebIntentInlineDispositionDelegate::OpenURLFromTab( |
29 content::WebContents* source, const content::OpenURLParams& params) { | 32 content::WebContents* source, const content::OpenURLParams& params) { |
30 DCHECK(source); // Can only be invoked from inline disposition. | 33 DCHECK(source); // Can only be invoked from inline disposition. |
31 | 34 |
32 // Load in place. | 35 // Load in place. |
33 source->GetController().LoadURL(params.url, content::Referrer(), | 36 source->GetController().LoadURL(params.url, content::Referrer(), |
34 content::PAGE_TRANSITION_START_PAGE, std::string()); | 37 content::PAGE_TRANSITION_START_PAGE, std::string()); |
35 | 38 |
36 // Remove previous history entries - users should not navigate in intents. | 39 // Remove previous history entries - users should not navigate in intents. |
37 source->GetController().PruneAllButActive(); | 40 source->GetController().PruneAllButActive(); |
38 | 41 |
39 return source; | 42 return source; |
40 } | 43 } |
| 44 |
| 45 void WebIntentInlineDispositionDelegate::LoadingStateChanged( |
| 46 content::WebContents* source) { |
| 47 if (!source->IsLoading()) |
| 48 picker_->OnInlineDispositionWebContentsLoaded(source); |
| 49 } |
| 50 |
OLD | NEW |