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

Issue 2596763003: On macOS, avoid forcible activation during Show.

Created:
4 years ago by anpol
Modified:
3 years, 10 months ago
Reviewers:
tapted, sky
CC:
chromium-reviews, tfarina
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

On macOS, avoid forcible activation during Show. When Chromium is already launched, and another application requests it to open an URL in background, browser should not activate itself. BUG=676313

Patch Set 1 #

Total comments: 6

Patch Set 2 : Reword comment. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -0 lines) Patch
M chrome/browser/ui/views/frame/browser_view.cc View 1 1 chunk +8 lines, -0 lines 2 comments Download

Messages

Total messages: 11 (4 generated)
anpol
PTAL
4 years ago (2016-12-21 16:22:02 UTC) #3
Peter Kasting
Hmm. I don't feel I understand enough about the ways in which Show() is called ...
4 years ago (2016-12-22 00:38:42 UTC) #4
anpol
On 2016/12/22 00:38:42, Peter Kasting wrote: > Hmm. I don't feel I understand enough about ...
4 years ago (2016-12-22 15:02:26 UTC) #6
tapted
https://codereview.chromium.org/2596763003/diff/1/chrome/browser/ui/views/frame/browser_view.cc File chrome/browser/ui/views/frame/browser_view.cc (right): https://codereview.chromium.org/2596763003/diff/1/chrome/browser/ui/views/frame/browser_view.cc#newcode604 chrome/browser/ui/views/frame/browser_view.cc:604: BrowserList::SetLastActive(browser()); Please respond to comments on the code itself ...
3 years, 11 months ago (2017-01-03 03:27:06 UTC) #7
sky
https://codereview.chromium.org/2596763003/diff/20001/chrome/browser/ui/views/frame/browser_view.cc File chrome/browser/ui/views/frame/browser_view.cc (right): https://codereview.chromium.org/2596763003/diff/20001/chrome/browser/ui/views/frame/browser_view.cc#newcode639 chrome/browser/ui/views/frame/browser_view.cc:639: frame_->Show(); On 2017/01/03 03:27:06, tapted wrote: > This isn't ...
3 years, 11 months ago (2017-01-03 16:38:01 UTC) #8
tapted
On 2017/01/03 16:38:01, sky (OOO) wrote: > > Note you will still need sky@ to ...
3 years, 11 months ago (2017-01-03 23:18:35 UTC) #9
sky
3 years, 11 months ago (2017-01-04 00:05:17 UTC) #10
On Tue, Jan 3, 2017 at 3:18 PM,  <tapted@chromium.org> wrote:
> On 2017/01/03 16:38:01, sky (OOO) wrote:
>> > Note you will still need sky@ to chime in about
>> > WidgetDelegate::WidgetActivatesApplication() -- I think that's the
>> > neatest
>> > option, but he might see an approach I've missed.
>>
>> Is the problem that there are two many random places calling show and you
>> need
> a
>> way to alter what Show does without changing every place? And that you
>> want to
>> do something like:
>>
>> make_show_not_activate_app = true;
>> Show();
>> make_show_not_activate_app = false;
>>
>> ?
>
> That's a good summary.
>
> Mac effectively has a "key" window per-application, so
> Show/Activate/ShowInactive don't cover all the operations.
>
> Although, with the current understanding of the problem, the number of
> callsites
> may be manageable. E.g. adding Widget::ShowWithoutActivatingApplication()
> (or
> Widget::MakeKeyWindow()?), along with an equivalent ui::BaseWindow function
> could be enough.
>
> Note BrowserWindowCocoa::Show() effectively always calls
> Widget::ShowWithoutActivatingApplication(), and
> BrowserWindowCocoa::Activate()
> effectively always calls Show().
>
> So something else to investigate would be to be more rigid about this. That
> is,
> *only* a call to ui::BaseWindow::Activate() or Widget::Activate() would
> activate
> the application - but that will require some epic updates to tests and
> things,
> and it doesn't fit the current contract of Show()/Activate(). I.e. (from
> BaseWindow)
>
> // Shows the window, or activates it if it's already visible.
> virtual void Show() = 0;
>
> // Show the window, but do not activate it. Does nothing if window
> // is already visible.
> virtual void ShowInactive() = 0;
>
> // Activates (brings to front) the window. Restores the window from
> minimized
> // state if necessary.
> virtual void Activate() = 0;
>
>
> These would need to be something like
>
> // Shows the window, raises it, and focuses it (possibly un-minimizing as
> well).
> // Does not activate the application on Mac.
> virtual void Show() = 0;
>
> // Show the window and raises it, but does not transfer focus or activate
> the
> // application.
> virtual void ShowInactive() = 0;
>
> // Calls Show(), and activates the application.
> virtual void Activate() = 0;

The disadvantage of Show() is that it's easy to miss it doesn't
activate. I would rather have a single Show() that takes a parameter:
INACTIVE, FOCUS, ACTIVATE.

  -Scott

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698