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

Unified Diff: chrome/browser/ui/views/app_list/linux/app_list_linux.cc

Issue 225053004: Refactor views app list services to allow more code sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops - fix some names Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/app_list/linux/app_list_linux.cc
diff --git a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc
index 59be807c03715e30c21b42df8d7254eb0798ec6e..3b8914ef4b9357888d62d38b9a18c4475a64dd5a 100644
--- a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc
+++ b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc
@@ -4,29 +4,11 @@
#include "chrome/browser/ui/views/app_list/linux/app_list_linux.h"
-#include "base/command_line.h"
-#include "base/location.h"
-#include "base/single_thread_task_runner.h"
-#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/app_list/app_list_positioner.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
-AppListLinux::AppListLinux(app_list::AppListView* view,
- const base::Closure& on_should_dismiss)
- : view_(view),
- window_icon_updated_(false),
- on_should_dismiss_(on_should_dismiss) {
- view_->AddObserver(this);
-}
-
-AppListLinux::~AppListLinux() {
- view_->RemoveObserver(this);
-}
-
// static
gfx::Point AppListLinux::FindAnchorPoint(const gfx::Size& view_size,
const gfx::Display& display,
@@ -58,57 +40,19 @@ gfx::Point AppListLinux::FindAnchorPoint(const gfx::Size& view_size,
return positioner.GetAnchorPointForShelfCursor(edge, cursor);
}
-void AppListLinux::Show() {
- view_->GetWidget()->Show();
- if (!window_icon_updated_) {
- view_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon();
- window_icon_updated_ = true;
- }
- view_->GetWidget()->Activate();
-}
-
-void AppListLinux::Hide() {
- view_->GetWidget()->Hide();
-}
-
-void AppListLinux::MoveNearCursor() {
+// static
+void AppListLinux::MoveNearCursor(app_list::AppListView* view) {
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
gfx::Screen* screen =
- gfx::Screen::GetScreenFor(view_->GetWidget()->GetNativeView());
+ gfx::Screen::GetScreenFor(view->GetWidget()->GetNativeView());
gfx::Display display = screen->GetDisplayNearestPoint(cursor);
- view_->SetBubbleArrow(views::BubbleBorder::FLOAT);
+ view->SetBubbleArrow(views::BubbleBorder::FLOAT);
// Find which edge of the screen the shelf is attached to. For now, just
// assume Ubuntu Unity (fixed to left edge).
// TODO(mgiuca): Support other window manager configurations, and multiple
Matt Giuca 2014/04/29 03:52:51 Sorry, you're going to have a minor merge conflict
tapted 2014/04/29 04:20:30 No probs!
tapted 2014/04/30 03:26:03 Done.
// monitors (where the current display may not have an edge).
AppListPositioner::ScreenEdge edge = AppListPositioner::SCREEN_EDGE_LEFT;
- view_->SetAnchorPoint(FindAnchorPoint(view_->GetPreferredSize(), display,
- cursor, edge));
-}
-
-bool AppListLinux::IsVisible() {
- return view_->GetWidget()->IsVisible();
-}
-
-void AppListLinux::Prerender() {
- view_->Prerender();
-}
-
-gfx::NativeWindow AppListLinux::GetWindow() {
- return view_->GetWidget()->GetNativeWindow();
-}
-
-void AppListLinux::SetProfile(Profile* profile) {
- view_->SetProfileByPath(profile->GetPath());
-}
-
-void AppListLinux::OnActivationChanged(
- views::Widget* /*widget*/, bool active) {
- if (active)
- return;
-
- // Call |on_should_dismiss_| asynchronously. This must be done asynchronously
- // or our caller will crash, as it expects the app list to remain alive.
- base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, on_should_dismiss_);
+ view->SetAnchorPoint(
+ FindAnchorPoint(view->GetPreferredSize(), display, cursor, edge));
}

Powered by Google App Engine
This is Rietveld 408576698