OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bookmark_menu_button.h" | 5 #include "chrome/browser/views/bookmark_menu_button.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_GTK) | 9 #if defined(OS_GTK) |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
11 #endif | 11 #endif |
12 | 12 |
| 13 #include "app/os_exchange_data.h" |
13 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
14 #include "app/os_exchange_data.h" | 15 #include "app/theme_provider.h" |
15 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
16 #include "chrome/browser/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/bookmarks/bookmark_utils.h" |
17 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
18 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
19 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" |
20 #include "chrome/browser/view_ids.h" | 21 #include "chrome/browser/view_ids.h" |
21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
22 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
23 | 24 |
24 BookmarkMenuButton::BookmarkMenuButton(Browser* browser) | 25 BookmarkMenuButton::BookmarkMenuButton(Browser* browser) |
25 : views::MenuButton(NULL, std::wstring(), NULL, false), | 26 : views::MenuButton(NULL, std::wstring(), NULL, false), |
26 browser_(browser), | 27 browser_(browser), |
27 bookmark_drop_menu_(NULL), | 28 bookmark_drop_menu_(NULL), |
28 drop_operation_(0) { | 29 drop_operation_(0) { |
29 set_menu_delegate(this); | 30 set_menu_delegate(this); |
30 SetID(VIEW_ID_BOOKMARK_MENU); | 31 SetID(VIEW_ID_BOOKMARK_MENU); |
31 | 32 |
32 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 33 ThemeProvider* tp = browser_->profile()->GetThemeProvider(); |
33 // TODO (sky): if we keep this code, we need real icons, a11y support, and a | 34 // TODO(sky): if we keep this code, we need real icons, a11y support, and a |
34 // tooltip. | 35 // tooltip. |
35 SetIcon(*rb.GetBitmapNamed(IDR_MENU_BOOKMARK)); | 36 SetIcon(*tp->GetBitmapNamed(IDR_MENU_BOOKMARK)); |
36 } | 37 } |
37 | 38 |
38 BookmarkMenuButton::~BookmarkMenuButton() { | 39 BookmarkMenuButton::~BookmarkMenuButton() { |
39 if (bookmark_drop_menu_) | 40 if (bookmark_drop_menu_) |
40 bookmark_drop_menu_->set_observer(NULL); | 41 bookmark_drop_menu_->set_observer(NULL); |
41 } | 42 } |
42 | 43 |
43 bool BookmarkMenuButton::GetDropFormats( | 44 bool BookmarkMenuButton::GetDropFormats( |
44 int* formats, | 45 int* formats, |
45 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 46 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 this, &BookmarkMenuButton::ShowDropMenu); | 164 this, &BookmarkMenuButton::ShowDropMenu); |
164 } | 165 } |
165 | 166 |
166 void BookmarkMenuButton::StopShowFolderDropMenuTimer() { | 167 void BookmarkMenuButton::StopShowFolderDropMenuTimer() { |
167 show_drop_menu_timer_.Stop(); | 168 show_drop_menu_timer_.Stop(); |
168 } | 169 } |
169 | 170 |
170 void BookmarkMenuButton::ShowDropMenu() { | 171 void BookmarkMenuButton::ShowDropMenu() { |
171 RunMenu(NULL, gfx::Point(), GetWidget()->GetNativeView(), true); | 172 RunMenu(NULL, gfx::Point(), GetWidget()->GetNativeView(), true); |
172 } | 173 } |
OLD | NEW |