Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/apps/chrome_native_app_window_views.h" 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "apps/ui/views/app_window_frame_view.h" 10 #include "apps/ui/views/app_window_frame_view.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/app_mode/app_mode_utils.h" 14 #include "chrome/browser/app_mode/app_mode_utils.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" 16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
17 #include "components/favicon/content/content_favicon_driver.h" 17 #include "components/favicon/content/content_favicon_driver.h"
18 #include "components/ui/zoom/page_zoom.h" 18 #include "components/zoom/page_zoom.h"
19 #include "components/ui/zoom/zoom_controller.h" 19 #include "components/zoom/zoom_controller.h"
20 #include "ui/views/controls/webview/webview.h" 20 #include "ui/views/controls/webview/webview.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 using extensions::AppWindow; 23 using extensions::AppWindow;
24 24
25 namespace { 25 namespace {
26 26
27 const int kMinPanelWidth = 100; 27 const int kMinPanelWidth = 100;
28 const int kMinPanelHeight = 100; 28 const int kMinPanelHeight = 100;
29 const int kDefaultPanelWidth = 200; 29 const int kDefaultPanelWidth = 200;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // registered. This CHECK catches the case. 174 // registered. This CHECK catches the case.
175 CHECK(!is_kiosk_app_mode || 175 CHECK(!is_kiosk_app_mode ||
176 accelerator_table.size() == 176 accelerator_table.size() ==
177 arraysize(kAppWindowAcceleratorMap) + 177 arraysize(kAppWindowAcceleratorMap) +
178 arraysize(kAppWindowKioskAppModeAcceleratorMap)); 178 arraysize(kAppWindowKioskAppModeAcceleratorMap));
179 179
180 // Ensure there is a ZoomController in kiosk mode, otherwise the processing 180 // Ensure there is a ZoomController in kiosk mode, otherwise the processing
181 // of the accelerators will cause a crash. Note CHECK here because DCHECK 181 // of the accelerators will cause a crash. Note CHECK here because DCHECK
182 // will not be noticed, as this could only be relevant on real hardware. 182 // will not be noticed, as this could only be relevant on real hardware.
183 CHECK(!is_kiosk_app_mode || 183 CHECK(!is_kiosk_app_mode ||
184 ui_zoom::ZoomController::FromWebContents(web_view()->GetWebContents())); 184 zoom::ZoomController::FromWebContents(web_view()->GetWebContents()));
185 185
186 for (std::map<ui::Accelerator, int>::const_iterator iter = 186 for (std::map<ui::Accelerator, int>::const_iterator iter =
187 accelerator_table.begin(); 187 accelerator_table.begin();
188 iter != accelerator_table.end(); ++iter) { 188 iter != accelerator_table.end(); ++iter) {
189 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second)) 189 if (is_kiosk_app_mode && !chrome::IsCommandAllowedInAppMode(iter->second))
190 continue; 190 continue;
191 191
192 focus_manager->RegisterAccelerator( 192 focus_manager->RegisterAccelerator(
193 iter->first, ui::AcceleratorManager::kNormalPriority, this); 193 iter->first, ui::AcceleratorManager::kNormalPriority, this);
194 } 194 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 GetAcceleratorTable(); 304 GetAcceleratorTable();
305 std::map<ui::Accelerator, int>::const_iterator iter = 305 std::map<ui::Accelerator, int>::const_iterator iter =
306 accelerator_table.find(accelerator); 306 accelerator_table.find(accelerator);
307 DCHECK(iter != accelerator_table.end()); 307 DCHECK(iter != accelerator_table.end());
308 int command_id = iter->second; 308 int command_id = iter->second;
309 switch (command_id) { 309 switch (command_id) {
310 case IDC_CLOSE_WINDOW: 310 case IDC_CLOSE_WINDOW:
311 Close(); 311 Close();
312 return true; 312 return true;
313 case IDC_ZOOM_MINUS: 313 case IDC_ZOOM_MINUS:
314 ui_zoom::PageZoom::Zoom(web_view()->GetWebContents(), 314 zoom::PageZoom::Zoom(web_view()->GetWebContents(),
315 content::PAGE_ZOOM_OUT); 315 content::PAGE_ZOOM_OUT);
316 return true; 316 return true;
317 case IDC_ZOOM_NORMAL: 317 case IDC_ZOOM_NORMAL:
318 ui_zoom::PageZoom::Zoom(web_view()->GetWebContents(), 318 zoom::PageZoom::Zoom(web_view()->GetWebContents(),
319 content::PAGE_ZOOM_RESET); 319 content::PAGE_ZOOM_RESET);
320 return true; 320 return true;
321 case IDC_ZOOM_PLUS: 321 case IDC_ZOOM_PLUS:
322 ui_zoom::PageZoom::Zoom(web_view()->GetWebContents(), 322 zoom::PageZoom::Zoom(web_view()->GetWebContents(), content::PAGE_ZOOM_IN);
323 content::PAGE_ZOOM_IN);
324 return true; 323 return true;
325 default: 324 default:
326 NOTREACHED() << "Unknown accelerator sent to app window."; 325 NOTREACHED() << "Unknown accelerator sent to app window.";
327 } 326 }
328 return NativeAppWindowViews::AcceleratorPressed(accelerator); 327 return NativeAppWindowViews::AcceleratorPressed(accelerator);
329 } 328 }
330 329
331 // NativeAppWindow implementation. 330 // NativeAppWindow implementation.
332 331
333 void ChromeNativeAppWindowViews::SetFullscreen(int fullscreen_types) { 332 void ChromeNativeAppWindowViews::SetFullscreen(int fullscreen_types) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 InitializePanelWindow(create_params); 373 InitializePanelWindow(create_params);
375 } else { 374 } else {
376 InitializeDefaultWindow(create_params); 375 InitializeDefaultWindow(create_params);
377 } 376 }
378 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( 377 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
379 Profile::FromBrowserContext(app_window->browser_context()), 378 Profile::FromBrowserContext(app_window->browser_context()),
380 widget()->GetFocusManager(), 379 widget()->GetFocusManager(),
381 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 380 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
382 NULL)); 381 NULL));
383 } 382 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/app_menu_model.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698