| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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 "ash/shelf/app_list_button.h" |    5 #include "ash/shelf/app_list_button.h" | 
|    6  |    6  | 
|    7 #include <memory> |    7 #include <memory> | 
|    8 #include <utility> |    8 #include <utility> | 
|    9  |    9  | 
|   10 #include "ash/public/cpp/shelf_types.h" |   10 #include "ash/public/cpp/shelf_types.h" | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   37                              Shelf* shelf) |   37                              Shelf* shelf) | 
|   38     : views::ImageButton(nullptr), |   38     : views::ImageButton(nullptr), | 
|   39       is_showing_app_list_(false), |   39       is_showing_app_list_(false), | 
|   40       background_color_(kShelfDefaultBaseColor), |   40       background_color_(kShelfDefaultBaseColor), | 
|   41       listener_(listener), |   41       listener_(listener), | 
|   42       shelf_view_(shelf_view), |   42       shelf_view_(shelf_view), | 
|   43       shelf_(shelf) { |   43       shelf_(shelf) { | 
|   44   DCHECK(listener_); |   44   DCHECK(listener_); | 
|   45   DCHECK(shelf_view_); |   45   DCHECK(shelf_view_); | 
|   46   DCHECK(shelf_); |   46   DCHECK(shelf_); | 
|   47   Shell::Get()->AddShellObserver(this); |   47  | 
|   48   SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); |   48   SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); | 
|   49   set_ink_drop_base_color(kShelfInkDropBaseColor); |   49   set_ink_drop_base_color(kShelfInkDropBaseColor); | 
|   50   set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |   50   set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 
|   51   SetAccessibleName( |   51   SetAccessibleName( | 
|   52       l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE)); |   52       l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE)); | 
|   53   SetSize(gfx::Size(kShelfSize, kShelfSize)); |   53   SetSize(gfx::Size(kShelfSize, kShelfSize)); | 
|   54   SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); |   54   SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); | 
|   55   set_notify_action(CustomButton::NOTIFY_ON_PRESS); |   55   set_notify_action(CustomButton::NOTIFY_ON_PRESS); | 
|   56 } |   56 } | 
|   57  |   57  | 
|   58 AppListButton::~AppListButton() { |   58 AppListButton::~AppListButton() {} | 
|   59   Shell::Get()->RemoveShellObserver(this); |  | 
|   60 } |  | 
|   61  |   59  | 
|   62 void AppListButton::OnAppListShown() { |   60 void AppListButton::OnAppListShown() { | 
|   63   AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); |   61   AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); | 
|   64   is_showing_app_list_ = true; |   62   is_showing_app_list_ = true; | 
|   65   shelf_->UpdateAutoHideState(); |   63   shelf_->UpdateAutoHideState(); | 
|   66 } |   64 } | 
|   67  |   65  | 
|   68 void AppListButton::OnAppListDismissed() { |   66 void AppListButton::OnAppListDismissed() { | 
|   69   AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); |   67   AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); | 
|   70   is_showing_app_list_ = false; |   68   is_showing_app_list_ = false; | 
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  234       alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { |  232       alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 
|  235     return gfx::Point(x_mid, x_mid); |  233     return gfx::Point(x_mid, x_mid); | 
|  236   } else if (alignment == SHELF_ALIGNMENT_RIGHT) { |  234   } else if (alignment == SHELF_ALIGNMENT_RIGHT) { | 
|  237     return gfx::Point(y_mid, y_mid); |  235     return gfx::Point(y_mid, y_mid); | 
|  238   } else { |  236   } else { | 
|  239     DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); |  237     DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); | 
|  240     return gfx::Point(width() - y_mid, y_mid); |  238     return gfx::Point(width() - y_mid, y_mid); | 
|  241   } |  239   } | 
|  242 } |  240 } | 
|  243  |  241  | 
|  244 void AppListButton::OnAppListVisibilityChanged(bool shown, |  | 
|  245                                                aura::Window* root_window) { |  | 
|  246   if (shelf_ != Shelf::ForWindow(root_window)) |  | 
|  247     return; |  | 
|  248  |  | 
|  249   if (shown) |  | 
|  250     OnAppListShown(); |  | 
|  251   else |  | 
|  252     OnAppListDismissed(); |  | 
|  253 } |  | 
|  254  |  | 
|  255 }  // namespace ash |  242 }  // namespace ash | 
| OLD | NEW |