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

Side by Side Diff: chrome/browser/chromeos/status/memory_menu_button.h

Issue 10056001: chromeos: Remove old status-area related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_MEMORY_MENU_BUTTON_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_MEMORY_MENU_BUTTON_H_
7 #pragma once
8
9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h"
11 #include "chrome/browser/chromeos/status/status_area_button.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "ui/views/controls/button/menu_button_listener.h"
15 #include "ui/views/controls/menu/menu_delegate.h"
16
17 namespace base {
18 struct SystemMemoryInfoKB;
19 }
20
21 namespace views {
22 class MenuItemView;
23 class MenuRunner;
24 }
25
26 // Memory debugging display that lives in the status area.
27 class MemoryMenuButton : public StatusAreaButton,
28 public views::MenuDelegate,
29 public views::MenuButtonListener,
30 public content::NotificationObserver {
31 public:
32 explicit MemoryMenuButton(StatusAreaButton::Delegate* delegate);
33 virtual ~MemoryMenuButton();
34
35 // views::MenuDelegate implementation
36 virtual string16 GetLabel(int id) const OVERRIDE;
37 virtual bool IsCommandEnabled(int id) const OVERRIDE;
38 virtual void ExecuteCommand(int id) OVERRIDE;
39
40 // views::MenuButtonListener implementation.
41 virtual void OnMenuButtonClicked(views::View* source,
42 const gfx::Point& point) OVERRIDE;
43
44 // content::NotificationObserver overrides.
45 virtual void Observe(int type,
46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) OVERRIDE;
48
49 // Updates the text on the menu button.
50 void UpdateText();
51
52 protected:
53 virtual int horizontal_padding() OVERRIDE;
54
55 private:
56 // Execute command id for each renderer. Used for heap profiling.
57 void SendCommandToRenderers(int id);
58
59 // Creates and returns the menu. The caller owns the returned value.
60 views::MenuItemView* CreateMenu();
61
62 // Updates text and schedules the timer to fire at the next minute interval.
63 void UpdateTextAndSetNextTimer();
64
65 base::OneShotTimer<MemoryMenuButton> timer_;
66
67 // Raw data from /proc/meminfo
68 scoped_ptr<base::SystemMemoryInfoKB> meminfo_;
69
70 content::NotificationRegistrar registrar_;
71
72 // Number of renderer kills we have observed.
73 int renderer_kills_;
74
75 scoped_ptr<views::MenuRunner> menu_runner_;
76
77 DISALLOW_COPY_AND_ASSIGN(MemoryMenuButton);
78 };
79
80 #endif // CHROME_BROWSER_CHROMEOS_STATUS_MEMORY_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/input_method_menu_unittest.cc ('k') | chrome/browser/chromeos/status/memory_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698