Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "chrome/browser/ui/find_bar/find_bar.h" | 43 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 46 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 46 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 47 #include "chrome/browser/ui/location_bar/location_bar.h" | 47 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 49 #include "chrome/browser/ui/search/search_tab_helper.h" | 49 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 50 #include "chrome/browser/ui/status_bubble.h" | 50 #include "chrome/browser/ui/status_bubble.h" |
| 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 53 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | |
| 53 #include "chrome/browser/ui/zoom/zoom_controller.h" | 54 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 54 #include "chrome/browser/upgrade_detector.h" | 55 #include "chrome/browser/upgrade_detector.h" |
| 55 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/chrome_version_info.h" | 57 #include "chrome/common/chrome_version_info.h" |
| 57 #include "chrome/common/content_restriction.h" | 58 #include "chrome/common/content_restriction.h" |
| 58 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
| 59 #include "components/bookmarks/browser/bookmark_model.h" | 60 #include "components/bookmarks/browser/bookmark_model.h" |
| 60 #include "components/bookmarks/browser/bookmark_utils.h" | 61 #include "components/bookmarks/browser/bookmark_utils.h" |
| 61 #include "components/google/core/browser/google_util.h" | 62 #include "components/google/core/browser/google_util.h" |
| 62 #include "components/translate/core/browser/language_state.h" | 63 #include "components/translate/core/browser/language_state.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 return zoom_controller->GetZoomPercent() != | 602 return zoom_controller->GetZoomPercent() != |
| 602 contents->GetMaximumZoomPercent() + 1; | 603 contents->GetMaximumZoomPercent() + 1; |
| 603 } | 604 } |
| 604 | 605 |
| 605 bool CanZoomOut(content::WebContents* contents) { | 606 bool CanZoomOut(content::WebContents* contents) { |
| 606 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 607 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); |
| 607 return zoom_controller->GetZoomPercent() != | 608 return zoom_controller->GetZoomPercent() != |
| 608 contents->GetMinimumZoomPercent(); | 609 contents->GetMinimumZoomPercent(); |
| 609 } | 610 } |
| 610 | 611 |
| 611 bool ActualSize(content::WebContents* contents) { | 612 bool ActualSize(content::WebContents* contents, Browser* browser) { |
| 612 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 613 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); |
| 613 return zoom_controller->GetZoomPercent() != 100.0f; | 614 return zoom_controller->GetZoomPercent() != |
| 615 zoom_controller->GetDefaultZoomPercent(); | |
|
Alexei Svitkine (slow)
2014/10/28 13:15:54
Can't you use zoom_controller->IsAtDefaultZoom() i
| |
| 614 } | 616 } |
| 615 | 617 |
| 616 TabStripModelDelegate::RestoreTabType GetRestoreTabType( | 618 TabStripModelDelegate::RestoreTabType GetRestoreTabType( |
| 617 const Browser* browser) { | 619 const Browser* browser) { |
| 618 TabRestoreService* service = | 620 TabRestoreService* service = |
| 619 TabRestoreServiceFactory::GetForProfile(browser->profile()); | 621 TabRestoreServiceFactory::GetForProfile(browser->profile()); |
| 620 if (!service || service->entries().empty()) | 622 if (!service || service->entries().empty()) |
| 621 return TabStripModelDelegate::RESTORE_NONE; | 623 return TabStripModelDelegate::RESTORE_NONE; |
| 622 if (service->entries().front()->type == TabRestoreService::WINDOW) | 624 if (service->entries().front()->type == TabRestoreService::WINDOW) |
| 623 return TabStripModelDelegate::RESTORE_WINDOW; | 625 return TabStripModelDelegate::RESTORE_WINDOW; |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1288 browser->host_desktop_type())); | 1290 browser->host_desktop_type())); |
| 1289 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1290 | 1292 |
| 1291 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1292 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1294 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1293 app_browser->window()->Show(); | 1295 app_browser->window()->Show(); |
| 1294 } | 1296 } |
| 1295 #endif // defined(ENABLE_EXTENSIONS) | 1297 #endif // defined(ENABLE_EXTENSIONS) |
| 1296 | 1298 |
| 1297 } // namespace chrome | 1299 } // namespace chrome |
| OLD | NEW |