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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10459044: Fix inconsistency in browser shortcut handling when a BrowserAction popup is focused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix, rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.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 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 // Note: This will be called several times if TabStripEmpty is called several 3034 // Note: This will be called several times if TabStripEmpty is called several
3035 // times. This is because it does not close the window if tabs are 3035 // times. This is because it does not close the window if tabs are
3036 // still present. 3036 // still present.
3037 MessageLoop::current()->PostTask( 3037 MessageLoop::current()->PostTask(
3038 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); 3038 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr()));
3039 // Set is_attempting_to_close_browser_ here, so that extensions, etc, do not 3039 // Set is_attempting_to_close_browser_ here, so that extensions, etc, do not
3040 // attempt to add tabs to the browser before it closes. 3040 // attempt to add tabs to the browser before it closes.
3041 is_attempting_to_close_browser_ = true; 3041 is_attempting_to_close_browser_ = true;
3042 } 3042 }
3043 3043
3044 bool Browser::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
3045 bool* is_keyboard_shortcut) {
3046 // Escape exits tabbed fullscreen mode.
3047 // TODO(koz): Write a test for this http://crbug.com/100441.
3048 if (event.windowsKeyCode == 27 &&
3049 fullscreen_controller_->HandleUserPressedEscape()) {
3050 return true;
3051 }
3052 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut);
3053 }
3054
3055 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
3056 window()->HandleKeyboardEvent(event);
3057 }
3058
3044 void Browser::OnAcceptFullscreenPermission( 3059 void Browser::OnAcceptFullscreenPermission(
3045 const GURL& url, 3060 const GURL& url,
3046 FullscreenExitBubbleType bubble_type) { 3061 FullscreenExitBubbleType bubble_type) {
3047 fullscreen_controller_->OnAcceptFullscreenPermission(url, bubble_type); 3062 fullscreen_controller_->OnAcceptFullscreenPermission(url, bubble_type);
3048 } 3063 }
3049 3064
3050 void Browser::OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type) { 3065 void Browser::OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type) {
3051 fullscreen_controller_->OnDenyFullscreenPermission(bubble_type); 3066 fullscreen_controller_->OnDenyFullscreenPermission(bubble_type);
3052 } 3067 }
3053 3068
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 3466
3452 void Browser::ViewSourceForFrame(WebContents* source, 3467 void Browser::ViewSourceForFrame(WebContents* source,
3453 const GURL& frame_url, 3468 const GURL& frame_url,
3454 const std::string& frame_content_state) { 3469 const std::string& frame_content_state) {
3455 DCHECK(source); 3470 DCHECK(source);
3456 TabContents* tab_contents = GetTabContentsAt( 3471 TabContents* tab_contents = GetTabContentsAt(
3457 tab_strip_model_->GetWrapperIndex(source)); 3472 tab_strip_model_->GetWrapperIndex(source));
3458 ViewSource(tab_contents, frame_url, frame_content_state); 3473 ViewSource(tab_contents, frame_url, frame_content_state);
3459 } 3474 }
3460 3475
3461 bool Browser::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
3462 bool* is_keyboard_shortcut) {
3463 // Escape exits tabbed fullscreen mode.
3464 // TODO(koz): Write a test for this http://crbug.com/100441.
3465 if (event.windowsKeyCode == 27 &&
3466 fullscreen_controller_->HandleUserPressedEscape()) {
3467 return true;
3468 }
3469 return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut);
3470 }
3471
3472 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
3473 window()->HandleKeyboardEvent(event);
3474 }
3475
3476 void Browser::ShowRepostFormWarningDialog(WebContents* source) { 3476 void Browser::ShowRepostFormWarningDialog(WebContents* source) {
3477 browser::ShowTabModalConfirmDialog( 3477 browser::ShowTabModalConfirmDialog(
3478 new RepostFormWarningController(source), 3478 new RepostFormWarningController(source),
3479 TabContents::GetOwningTabContentsForWebContents(source)); 3479 TabContents::GetOwningTabContentsForWebContents(source));
3480 } 3480 }
3481 3481
3482 bool Browser::ShouldAddNavigationToHistory( 3482 bool Browser::ShouldAddNavigationToHistory(
3483 const history::HistoryAddPageArgs& add_page_args, 3483 const history::HistoryAddPageArgs& add_page_args,
3484 content::NavigationType navigation_type) { 3484 content::NavigationType navigation_type) {
3485 // Don't update history if running as app. 3485 // Don't update history if running as app.
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
5173 if (contents && !allow_js_access) { 5173 if (contents && !allow_js_access) {
5174 contents->web_contents()->GetController().LoadURL( 5174 contents->web_contents()->GetController().LoadURL(
5175 target_url, 5175 target_url,
5176 content::Referrer(), 5176 content::Referrer(),
5177 content::PAGE_TRANSITION_LINK, 5177 content::PAGE_TRANSITION_LINK,
5178 std::string()); // No extra headers. 5178 std::string()); // No extra headers.
5179 } 5179 }
5180 5180
5181 return contents != NULL; 5181 return contents != NULL;
5182 } 5182 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698