Skip to content

Commit

Permalink
Added popup that shows the new Back shortcut on Mac.
Browse files Browse the repository at this point in the history
Implements BrowserWindowCocoa::ShowNewBackShortcutBubble to open the
Views implementation of this bubble (similar to how the fullscreen
bubble works on Mac).

BUG=610039

Review-Url: https://codereview.chromium.org/2017813004
Cr-Commit-Position: refs/heads/master@{#396759}
(cherry picked from commit d8fdd17)

Review URL: https://codereview.chromium.org/2020273003 .

Cr-Commit-Position: refs/branch-heads/2743@{crosswalk-project#160}
Cr-Branched-From: 2b3ae3b-refs/heads/master@{#394939}
  • Loading branch information
mgiuca committed Jun 1, 2016
1 parent 1b794b5 commit 3afb8b6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class BrowserWindow;
class ExclusiveAccessBubbleViews;
@class ExclusiveAccessBubbleWindowController;
class GURL;
class NewBackShortcutBubble;

// Component placed into a browser window controller to manage communication
// with the exclusive access bubble, which appears for events such as entering
// with subtle notification bubbles, which appear for events such as entering
// fullscreen.
class ExclusiveAccessController : public ExclusiveAccessContext,
public ui::AcceleratorProvider,
Expand All @@ -46,6 +47,9 @@ class ExclusiveAccessController : public ExclusiveAccessContext,
// Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:.
void Show();

// Shows the new Back shortcut bubble.
void ShowNewBackShortcutBubble(bool forward);

// Closes any open bubble.
void Destroy();

Expand Down Expand Up @@ -100,6 +104,10 @@ class ExclusiveAccessController : public ExclusiveAccessContext,
std::unique_ptr<ExclusiveAccessBubbleViews> views_bubble_;
base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_;

// This class also manages the new Back shortcut bubble (which functions the
// same way as ExclusiveAccessBubbleViews).
std::unique_ptr<NewBackShortcutBubble> new_back_shortcut_bubble_;

// Used to keep track of the kShowFullscreenToolbar preference.
PrefChangeRegistrar pref_registrar_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/status_bubble.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/new_back_shortcut_bubble.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "ui/base/cocoa/cocoa_base_utils.h"
Expand Down Expand Up @@ -50,6 +51,13 @@
[cocoa_bubble_ showWindow];
}

void ExclusiveAccessController::ShowNewBackShortcutBubble(bool forward) {
if (new_back_shortcut_bubble_)
new_back_shortcut_bubble_->UpdateContent(forward);
else
new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward));
}

void ExclusiveAccessController::Destroy() {
views_bubble_.reset();
[cocoa_bubble_ closeImmediately];
Expand Down
5 changes: 3 additions & 2 deletions chrome/browser/ui/cocoa/browser_window_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ - (void)validateText:(NSString*)text {
}

void BrowserWindowCocoa::ShowNewBackShortcutBubble(bool forward) {
// TODO(mgiuca): Implement new back shortcut bubble Mac.
// https://crbug.com/610039.
ExclusiveAccessController* exclusive_access_controller =
[controller_ exclusiveAccessController];
exclusive_access_controller->ShowNewBackShortcutBubble(forward);
}

LocationBar* BrowserWindowCocoa::GetLocationBar() const {
Expand Down

0 comments on commit 3afb8b6

Please sign in to comment.