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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 688853005: Consolidate javascript_dialog_manager.h and javascript_dialog_manager_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 1495
1496 bool BrowserView::CanMaximize() const { 1496 bool BrowserView::CanMaximize() const {
1497 return true; 1497 return true;
1498 } 1498 }
1499 1499
1500 bool BrowserView::CanMinimize() const { 1500 bool BrowserView::CanMinimize() const {
1501 return true; 1501 return true;
1502 } 1502 }
1503 1503
1504 bool BrowserView::CanActivate() const { 1504 bool BrowserView::CanActivate() const {
1505 if (!AppModalDialogQueue::GetInstance()->active_dialog() || 1505 app_modal_dialogs::AppModalDialogQueue* queue =
1506 !AppModalDialogQueue::GetInstance()->active_dialog()->native_dialog()) 1506 app_modal_dialogs::AppModalDialogQueue::GetInstance();
1507 if (!queue->active_dialog() || !queue->active_dialog()->native_dialog())
1507 return true; 1508 return true;
1508 1509
1509 #if defined(USE_AURA) && defined(OS_CHROMEOS) 1510 #if defined(USE_AURA) && defined(OS_CHROMEOS)
1510 // On Aura window manager controls all windows so settings focus via PostTask 1511 // On Aura window manager controls all windows so settings focus via PostTask
1511 // will make only worse because posted task will keep trying to steal focus. 1512 // will make only worse because posted task will keep trying to steal focus.
1512 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 1513 app_modal_dialogs::AppModalDialogQueue::GetInstance()->ActivateModalDialog();
msw 2014/11/15 00:51:56 nit: use |queue| here.
oshima 2014/11/18 17:42:41 Done.
1513 #else 1514 #else
1514 // If another browser is app modal, flash and activate the modal browser. This 1515 // If another browser is app modal, flash and activate the modal browser. This
1515 // has to be done in a post task, otherwise if the user clicked on a window 1516 // has to be done in a post task, otherwise if the user clicked on a window
1516 // that doesn't have the modal dialog the windows keep trying to get the focus 1517 // that doesn't have the modal dialog the windows keep trying to get the focus
1517 // from each other on Windows. http://crbug.com/141650. 1518 // from each other on Windows. http://crbug.com/141650.
1518 base::MessageLoop::current()->PostTask( 1519 base::MessageLoop::current()->PostTask(
1519 FROM_HERE, 1520 FROM_HERE,
1520 base::Bind(&BrowserView::ActivateAppModalDialog, 1521 base::Bind(&BrowserView::ActivateAppModalDialog,
1521 activate_modal_dialog_factory_.GetWeakPtr())); 1522 activate_modal_dialog_factory_.GetWeakPtr()));
1522 #endif 1523 #endif
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 if (native_view->HasFocus()) { 2485 if (native_view->HasFocus()) {
2485 (contents->*method)(); 2486 (contents->*method)();
2486 return true; 2487 return true;
2487 } 2488 }
2488 2489
2489 return false; 2490 return false;
2490 } 2491 }
2491 2492
2492 void BrowserView::ActivateAppModalDialog() const { 2493 void BrowserView::ActivateAppModalDialog() const {
2493 // If another browser is app modal, flash and activate the modal browser. 2494 // If another browser is app modal, flash and activate the modal browser.
2494 AppModalDialog* active_dialog = 2495 app_modal_dialogs::AppModalDialog* active_dialog =
2495 AppModalDialogQueue::GetInstance()->active_dialog(); 2496 app_modal_dialogs::AppModalDialogQueue::GetInstance()->active_dialog();
2496 if (!active_dialog) 2497 if (!active_dialog)
2497 return; 2498 return;
2498 2499
2499 Browser* modal_browser = 2500 Browser* modal_browser =
2500 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2501 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2501 if (modal_browser && (browser_ != modal_browser)) { 2502 if (modal_browser && (browser_ != modal_browser)) {
2502 modal_browser->window()->FlashFrame(true); 2503 modal_browser->window()->FlashFrame(true);
2503 modal_browser->window()->Activate(); 2504 modal_browser->window()->Activate();
2504 } 2505 }
2505 2506
2506 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2507 app_modal_dialogs::AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2507 } 2508 }
2508 2509
2509 int BrowserView::GetMaxTopInfoBarArrowHeight() { 2510 int BrowserView::GetMaxTopInfoBarArrowHeight() {
2510 int top_arrow_height = 0; 2511 int top_arrow_height = 0;
2511 // Only show the arrows when not in fullscreen and when there's no omnibox 2512 // Only show the arrows when not in fullscreen and when there's no omnibox
2512 // popup. 2513 // popup.
2513 if (!IsFullscreen() && 2514 if (!IsFullscreen() &&
2514 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2515 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2515 gfx::Point icon_bottom( 2516 gfx::Point icon_bottom(
2516 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2517 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2517 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2518 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2518 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2519 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2519 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2520 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2520 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2521 top_arrow_height = infobar_top.y() - icon_bottom.y();
2521 } 2522 }
2522 return top_arrow_height; 2523 return top_arrow_height;
2523 } 2524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698