OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/launcher/browser_status_monitor.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/ui/ash/ash_util.h" |
11 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 12 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/browser/web_applications/web_app.h" | 20 #include "chrome/browser/web_applications/web_app.h" |
20 #include "content/public/browser/navigation_handle.h" | 21 #include "content/public/browser/navigation_handle.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 BrowserStatusMonitor* monitor_; | 76 BrowserStatusMonitor* monitor_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver); | 78 DISALLOW_COPY_AND_ASSIGN(LocalWebContentsObserver); |
78 }; | 79 }; |
79 | 80 |
80 BrowserStatusMonitor::BrowserStatusMonitor( | 81 BrowserStatusMonitor::BrowserStatusMonitor( |
81 ChromeLauncherController* launcher_controller) | 82 ChromeLauncherController* launcher_controller) |
82 : launcher_controller_(launcher_controller), | 83 : launcher_controller_(launcher_controller), |
83 browser_tab_strip_tracker_(this, this, this) { | 84 browser_tab_strip_tracker_(this, this, this) { |
84 DCHECK(launcher_controller_); | 85 DCHECK(launcher_controller_); |
85 ash::Shell::Get()->activation_client()->AddObserver(this); | 86 // TODO(crbug.com/557406): Fix this interaction pattern in Mash. |
| 87 if (!ash_util::IsRunningInMash()) |
| 88 ash::Shell::Get()->activation_client()->AddObserver(this); |
86 } | 89 } |
87 | 90 |
88 BrowserStatusMonitor::~BrowserStatusMonitor() { | 91 BrowserStatusMonitor::~BrowserStatusMonitor() { |
89 ash::Shell::Get()->activation_client()->RemoveObserver(this); | 92 if (!ash_util::IsRunningInMash()) |
| 93 ash::Shell::Get()->activation_client()->RemoveObserver(this); |
90 browser_tab_strip_tracker_.StopObservingAndSendOnBrowserRemoved(); | 94 browser_tab_strip_tracker_.StopObservingAndSendOnBrowserRemoved(); |
91 } | 95 } |
92 | 96 |
93 void BrowserStatusMonitor::Initialize() { | 97 void BrowserStatusMonitor::Initialize() { |
94 DCHECK(!initialized_); | 98 DCHECK(!initialized_); |
95 initialized_ = true; | 99 initialized_ = true; |
96 browser_tab_strip_tracker_.Init(); | 100 browser_tab_strip_tracker_.Init(); |
97 } | 101 } |
98 | 102 |
99 void BrowserStatusMonitor::UpdateAppItemState( | 103 void BrowserStatusMonitor::UpdateAppItemState( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 content::WebContents* contents) { | 314 content::WebContents* contents) { |
311 return launcher_controller_->GetShelfIDForWebContents(contents); | 315 return launcher_controller_->GetShelfIDForWebContents(contents); |
312 } | 316 } |
313 | 317 |
314 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( | 318 void BrowserStatusMonitor::SetShelfIDForBrowserWindowContents( |
315 Browser* browser, | 319 Browser* browser, |
316 content::WebContents* web_contents) { | 320 content::WebContents* web_contents) { |
317 launcher_controller_->GetBrowserShortcutLauncherItemController()-> | 321 launcher_controller_->GetBrowserShortcutLauncherItemController()-> |
318 SetShelfIDForBrowserWindowContents(browser, web_contents); | 322 SetShelfIDForBrowserWindowContents(browser, web_contents); |
319 } | 323 } |
OLD | NEW |