| 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/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 | 689 |
| 690 void ShowChromeToMobileBubble(Browser* browser) { | 690 void ShowChromeToMobileBubble(Browser* browser) { |
| 691 // Only show the bubble if the window is active, otherwise we may get into | 691 // Only show the bubble if the window is active, otherwise we may get into |
| 692 // weird situations where the bubble is deleted as soon as it is shown. | 692 // weird situations where the bubble is deleted as soon as it is shown. |
| 693 if (browser->window()->IsActive()) | 693 if (browser->window()->IsActive()) |
| 694 browser->window()->ShowChromeToMobileBubble(); | 694 browser->window()->ShowChromeToMobileBubble(); |
| 695 } | 695 } |
| 696 | 696 |
| 697 void ShareCurrentPage(Browser* browser) { | |
| 698 const GURL& current_url = chrome::GetActiveWebContents(browser)->GetURL(); | |
| 699 webkit_glue::WebIntentData intent_data( | |
| 700 ASCIIToUTF16("http://webintents.org/share"), | |
| 701 ASCIIToUTF16("text/uri-list"), | |
| 702 UTF8ToUTF16(current_url.spec())); | |
| 703 scoped_ptr<content::WebIntentsDispatcher> dispatcher( | |
| 704 content::WebIntentsDispatcher::Create(intent_data)); | |
| 705 static_cast<content::WebContentsDelegate*>(browser)-> | |
| 706 WebIntentDispatch(NULL, dispatcher.release()); | |
| 707 } | |
| 708 | |
| 709 void Print(Browser* browser) { | 697 void Print(Browser* browser) { |
| 710 printing::PrintViewManager* print_view_manager = | 698 printing::PrintViewManager* print_view_manager = |
| 711 printing::PrintViewManager::FromWebContents( | 699 printing::PrintViewManager::FromWebContents( |
| 712 GetActiveWebContents(browser)); | 700 GetActiveWebContents(browser)); |
| 713 if (browser->profile()->GetPrefs()->GetBoolean( | 701 if (browser->profile()->GetPrefs()->GetBoolean( |
| 714 prefs::kPrintPreviewDisabled)) | 702 prefs::kPrintPreviewDisabled)) |
| 715 print_view_manager->PrintNow(); | 703 print_view_manager->PrintNow(); |
| 716 else | 704 else |
| 717 print_view_manager->PrintPreviewNow(); | 705 print_view_manager->PrintPreviewNow(); |
| 718 } | 706 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 BrowserCommandsTabContentsCreator::CreateTabContents(contents); | 1062 BrowserCommandsTabContentsCreator::CreateTabContents(contents); |
| 1075 } | 1063 } |
| 1076 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 1064 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
| 1077 | 1065 |
| 1078 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1066 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1079 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1067 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1080 app_browser->window()->Show(); | 1068 app_browser->window()->Show(); |
| 1081 } | 1069 } |
| 1082 | 1070 |
| 1083 } // namespace chrome | 1071 } // namespace chrome |
| OLD | NEW |