| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 else | 237 else |
| 238 new_tab->GetController().Reload(true); | 238 new_tab->GetController().Reload(true); |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool IsShowingWebContentsModalDialog(const Browser* browser) { | 241 bool IsShowingWebContentsModalDialog(const Browser* browser) { |
| 242 WebContents* web_contents = | 242 WebContents* web_contents = |
| 243 browser->tab_strip_model()->GetActiveWebContents(); | 243 browser->tab_strip_model()->GetActiveWebContents(); |
| 244 if (!web_contents) | 244 if (!web_contents) |
| 245 return false; | 245 return false; |
| 246 | 246 |
| 247 // TODO(gbillock): This caller needs update to the PopupManager. It gets |
| 248 // called by the CanPrint method, which may be too restrictive if we allow |
| 249 // print preview to overlap -- we should just queue print requests or attach |
| 250 // a user gesture or whatever we know. |
| 251 |
| 247 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 252 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 248 WebContentsModalDialogManager::FromWebContents(web_contents); | 253 WebContentsModalDialogManager::FromWebContents(web_contents); |
| 249 return web_contents_modal_dialog_manager->IsDialogActive(); | 254 return web_contents_modal_dialog_manager->IsDialogActive(); |
| 250 } | 255 } |
| 251 | 256 |
| 252 bool PrintPreviewShowing(const Browser* browser) { | 257 bool PrintPreviewShowing(const Browser* browser) { |
| 253 #if defined(ENABLE_FULL_PRINTING) | 258 #if defined(ENABLE_FULL_PRINTING) |
| 254 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 259 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 255 printing::PrintPreviewDialogController* controller = | 260 printing::PrintPreviewDialogController* controller = |
| 256 printing::PrintPreviewDialogController::GetInstance(); | 261 printing::PrintPreviewDialogController::GetInstance(); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 733 |
| 729 case extensions::CommandService::BROWSER_ACTION: | 734 case extensions::CommandService::BROWSER_ACTION: |
| 730 // BookmarkCurrentPage is called through a user gesture, so it is safe | 735 // BookmarkCurrentPage is called through a user gesture, so it is safe |
| 731 // to call ShowBrowserActionPopup. | 736 // to call ShowBrowserActionPopup. |
| 732 browser->window()->ShowBrowserActionPopup(extension); | 737 browser->window()->ShowBrowserActionPopup(extension); |
| 733 return; | 738 return; |
| 734 | 739 |
| 735 case extensions::CommandService::PAGE_ACTION: | 740 case extensions::CommandService::PAGE_ACTION: |
| 736 browser->window()->ShowPageActionPopup(extension); | 741 browser->window()->ShowPageActionPopup(extension); |
| 737 return; | 742 return; |
| 738 }; | 743 } |
| 739 } | 744 } |
| 740 | 745 |
| 741 BookmarkCurrentPageInternal(browser); | 746 BookmarkCurrentPageInternal(browser); |
| 742 } | 747 } |
| 743 | 748 |
| 744 bool CanBookmarkCurrentPage(const Browser* browser) { | 749 bool CanBookmarkCurrentPage(const Browser* browser) { |
| 745 return CanBookmarkCurrentPageInternal(browser, true); | 750 return CanBookmarkCurrentPageInternal(browser, true); |
| 746 } | 751 } |
| 747 | 752 |
| 748 void BookmarkAllTabs(Browser* browser) { | 753 void BookmarkAllTabs(Browser* browser) { |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 browser->profile(), | 1262 browser->profile(), |
| 1258 browser->host_desktop_type())); | 1263 browser->host_desktop_type())); |
| 1259 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1264 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1260 | 1265 |
| 1261 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1266 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1262 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1267 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1263 app_browser->window()->Show(); | 1268 app_browser->window()->Show(); |
| 1264 } | 1269 } |
| 1265 | 1270 |
| 1266 } // namespace chrome | 1271 } // namespace chrome |
| OLD | NEW |