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 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 } | 2557 } |
2558 } | 2558 } |
2559 | 2559 |
2560 // static | 2560 // static |
2561 void Browser::RegisterIntentHandlerHelper(TabContents* tab, | 2561 void Browser::RegisterIntentHandlerHelper(TabContents* tab, |
2562 const string16& action, | 2562 const string16& action, |
2563 const string16& type, | 2563 const string16& type, |
2564 const string16& href, | 2564 const string16& href, |
2565 const string16& title, | 2565 const string16& title, |
2566 const string16& disposition) { | 2566 const string16& disposition) { |
| 2567 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) |
| 2568 return; |
| 2569 |
2567 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2570 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2568 tab); | 2571 tab); |
2569 if (!tcw || tcw->profile()->IsOffTheRecord()) | 2572 if (!tcw || tcw->profile()->IsOffTheRecord()) |
2570 return; | 2573 return; |
2571 | 2574 |
2572 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 2575 FaviconService* favicon_service = |
2573 return; | 2576 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
2574 | 2577 |
| 2578 // |href| can be relative to originating URL. Resolve if necessary. |
2575 GURL service_url(href); | 2579 GURL service_url(href); |
2576 if (!service_url.is_valid()) { | 2580 if (!service_url.is_valid()) { |
2577 const GURL& url = tab->GetURL(); | 2581 const GURL& url = tab->GetURL(); |
2578 service_url = url.Resolve(href); | 2582 service_url = url.Resolve(href); |
2579 } | 2583 } |
2580 | 2584 |
2581 webkit_glue::WebIntentServiceData service; | 2585 webkit_glue::WebIntentServiceData service; |
2582 service.service_url = service_url; | 2586 service.service_url = service_url; |
2583 service.action = action; | 2587 service.action = action; |
2584 service.type = type; | 2588 service.type = type; |
2585 service.title = title; | 2589 service.title = title; |
2586 service.setDisposition(disposition); | 2590 service.setDisposition(disposition); |
2587 | 2591 |
2588 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); | 2592 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); |
2589 infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate( | 2593 infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate( |
2590 infobar_helper, | 2594 infobar_helper, |
2591 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), | 2595 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), |
2592 service)); | 2596 service, |
| 2597 favicon_service, |
| 2598 tab->GetURL())); |
2593 } | 2599 } |
2594 | 2600 |
2595 // static | 2601 // static |
2596 void Browser::FindReplyHelper(TabContents* tab, | 2602 void Browser::FindReplyHelper(TabContents* tab, |
2597 int request_id, | 2603 int request_id, |
2598 int number_of_matches, | 2604 int number_of_matches, |
2599 const gfx::Rect& selection_rect, | 2605 const gfx::Rect& selection_rect, |
2600 int active_match_ordinal, | 2606 int active_match_ordinal, |
2601 bool final_update) { | 2607 bool final_update) { |
2602 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2608 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
(...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5494 } | 5500 } |
5495 | 5501 |
5496 void Browser::UpdateFullscreenExitBubbleContent() { | 5502 void Browser::UpdateFullscreenExitBubbleContent() { |
5497 GURL url; | 5503 GURL url; |
5498 if (fullscreened_tab_) | 5504 if (fullscreened_tab_) |
5499 url = fullscreened_tab_->tab_contents()->GetURL(); | 5505 url = fullscreened_tab_->tab_contents()->GetURL(); |
5500 | 5506 |
5501 window_->UpdateFullscreenExitBubbleContent( | 5507 window_->UpdateFullscreenExitBubbleContent( |
5502 url, GetFullscreenExitBubbleType()); | 5508 url, GetFullscreenExitBubbleType()); |
5503 } | 5509 } |
OLD | NEW |