OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 } | 2577 } |
2578 } | 2578 } |
2579 | 2579 |
2580 // static | 2580 // static |
2581 void Browser::RegisterIntentHandlerHelper(TabContents* tab, | 2581 void Browser::RegisterIntentHandlerHelper(TabContents* tab, |
2582 const string16& action, | 2582 const string16& action, |
2583 const string16& type, | 2583 const string16& type, |
2584 const string16& href, | 2584 const string16& href, |
2585 const string16& title, | 2585 const string16& title, |
2586 const string16& disposition) { | 2586 const string16& disposition) { |
| 2587 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) |
| 2588 return; |
| 2589 |
2587 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2590 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2588 tab); | 2591 tab); |
2589 if (!tcw || tcw->profile()->IsOffTheRecord()) | 2592 if (!tcw || tcw->profile()->IsOffTheRecord()) |
2590 return; | 2593 return; |
2591 | 2594 |
2592 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 2595 FaviconService* favicon_service = |
2593 return; | 2596 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
2594 | 2597 |
| 2598 // |href| can be relative to originating URL. Resolve if necessary. |
2595 GURL service_url(href); | 2599 GURL service_url(href); |
2596 if (!service_url.is_valid()) { | 2600 if (!service_url.is_valid()) { |
2597 const GURL& url = tab->GetURL(); | 2601 const GURL& url = tab->GetURL(); |
2598 service_url = url.Resolve(href); | 2602 service_url = url.Resolve(href); |
2599 } | 2603 } |
2600 | 2604 |
2601 webkit_glue::WebIntentServiceData service; | 2605 webkit_glue::WebIntentServiceData service; |
2602 service.service_url = service_url; | 2606 service.service_url = service_url; |
2603 service.action = action; | 2607 service.action = action; |
2604 service.type = type; | 2608 service.type = type; |
2605 service.title = title; | 2609 service.title = title; |
2606 service.setDisposition(disposition); | 2610 service.setDisposition(disposition); |
2607 | 2611 |
2608 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( | 2612 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( |
2609 tcw->infobar_tab_helper(), | 2613 tcw->infobar_tab_helper(), |
2610 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), | 2614 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), |
2611 service); | 2615 service, |
| 2616 favicon_service, |
| 2617 tab->GetURL()); |
2612 } | 2618 } |
2613 | 2619 |
2614 // static | 2620 // static |
2615 void Browser::FindReplyHelper(TabContents* tab, | 2621 void Browser::FindReplyHelper(TabContents* tab, |
2616 int request_id, | 2622 int request_id, |
2617 int number_of_matches, | 2623 int number_of_matches, |
2618 const gfx::Rect& selection_rect, | 2624 const gfx::Rect& selection_rect, |
2619 int active_match_ordinal, | 2625 int active_match_ordinal, |
2620 bool final_update) { | 2626 bool final_update) { |
2621 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2627 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5521 } | 5527 } |
5522 | 5528 |
5523 void Browser::UpdateFullscreenExitBubbleContent() { | 5529 void Browser::UpdateFullscreenExitBubbleContent() { |
5524 GURL url; | 5530 GURL url; |
5525 if (fullscreened_tab_) | 5531 if (fullscreened_tab_) |
5526 url = fullscreened_tab_->tab_contents()->GetURL(); | 5532 url = fullscreened_tab_->tab_contents()->GetURL(); |
5527 | 5533 |
5528 window_->UpdateFullscreenExitBubbleContent( | 5534 window_->UpdateFullscreenExitBubbleContent( |
5529 url, GetFullscreenExitBubbleType()); | 5535 url, GetFullscreenExitBubbleType()); |
5530 } | 5536 } |
OLD | NEW |