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 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 } | 2563 } |
2564 } | 2564 } |
2565 | 2565 |
2566 // static | 2566 // static |
2567 void Browser::RegisterIntentHandlerHelper(TabContents* tab, | 2567 void Browser::RegisterIntentHandlerHelper(TabContents* tab, |
2568 const string16& action, | 2568 const string16& action, |
2569 const string16& type, | 2569 const string16& type, |
2570 const string16& href, | 2570 const string16& href, |
2571 const string16& title, | 2571 const string16& title, |
2572 const string16& disposition) { | 2572 const string16& disposition) { |
| 2573 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) |
| 2574 return; |
| 2575 |
2573 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2576 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2574 tab); | 2577 tab); |
2575 if (!tcw || tcw->profile()->IsOffTheRecord()) | 2578 if (!tcw || tcw->profile()->IsOffTheRecord()) |
2576 return; | 2579 return; |
2577 | 2580 |
2578 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 2581 FaviconService* favicon_service = |
2579 return; | 2582 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
2580 | 2583 |
| 2584 // |href| can be relative to originating URL. Resolve if necessary. |
2581 GURL service_url(href); | 2585 GURL service_url(href); |
2582 if (!service_url.is_valid()) { | 2586 if (!service_url.is_valid()) { |
2583 const GURL& url = tab->GetURL(); | 2587 const GURL& url = tab->GetURL(); |
2584 service_url = url.Resolve(href); | 2588 service_url = url.Resolve(href); |
2585 } | 2589 } |
2586 | 2590 |
2587 webkit_glue::WebIntentServiceData service; | 2591 webkit_glue::WebIntentServiceData service; |
2588 service.service_url = service_url; | 2592 service.service_url = service_url; |
2589 service.action = action; | 2593 service.action = action; |
2590 service.type = type; | 2594 service.type = type; |
2591 service.title = title; | 2595 service.title = title; |
2592 service.setDisposition(disposition); | 2596 service.setDisposition(disposition); |
2593 | 2597 |
2594 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( | 2598 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( |
2595 tcw->infobar_tab_helper(), | 2599 tcw->infobar_tab_helper(), |
2596 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), | 2600 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), |
2597 service); | 2601 service, |
| 2602 favicon_service, |
| 2603 tab->GetURL()); |
2598 } | 2604 } |
2599 | 2605 |
2600 // static | 2606 // static |
2601 void Browser::FindReplyHelper(TabContents* tab, | 2607 void Browser::FindReplyHelper(TabContents* tab, |
2602 int request_id, | 2608 int request_id, |
2603 int number_of_matches, | 2609 int number_of_matches, |
2604 const gfx::Rect& selection_rect, | 2610 const gfx::Rect& selection_rect, |
2605 int active_match_ordinal, | 2611 int active_match_ordinal, |
2606 bool final_update) { | 2612 bool final_update) { |
2607 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2613 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5507 } | 5513 } |
5508 | 5514 |
5509 void Browser::UpdateFullscreenExitBubbleContent() { | 5515 void Browser::UpdateFullscreenExitBubbleContent() { |
5510 GURL url; | 5516 GURL url; |
5511 if (fullscreened_tab_) | 5517 if (fullscreened_tab_) |
5512 url = fullscreened_tab_->tab_contents()->GetURL(); | 5518 url = fullscreened_tab_->tab_contents()->GetURL(); |
5513 | 5519 |
5514 window_->UpdateFullscreenExitBubbleContent( | 5520 window_->UpdateFullscreenExitBubbleContent( |
5515 url, GetFullscreenExitBubbleType()); | 5521 url, GetFullscreenExitBubbleType()); |
5516 } | 5522 } |
OLD | NEW |