OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/toolbar/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 #if defined(TOOLKIT_USES_GTK) | 41 #if defined(TOOLKIT_USES_GTK) |
42 #include <gtk/gtk.h> | 42 #include <gtk/gtk.h> |
43 #include "chrome/browser/ui/gtk/gtk_util.h" | 43 #include "chrome/browser/ui/gtk/gtk_util.h" |
44 #endif | 44 #endif |
45 | 45 |
46 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
47 #include "chrome/browser/ui/browser_window.h" | 47 #include "chrome/browser/ui/browser_window.h" |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(OS_CHROMEOS) | |
51 #include "chrome/browser/chromeos/cros/cros_library.h" | |
52 #include "chrome/browser/chromeos/cros/update_library.h" | |
53 #endif | |
54 | |
55 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
56 #include "chrome/browser/enumerate_modules_model_win.h" | 51 #include "chrome/browser/enumerate_modules_model_win.h" |
57 #endif | 52 #endif |
58 | 53 |
59 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
60 // EncodingMenuModel | 55 // EncodingMenuModel |
61 | 56 |
62 EncodingMenuModel::EncodingMenuModel(Browser* browser) | 57 EncodingMenuModel::EncodingMenuModel(Browser* browser) |
63 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), | 58 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
64 browser_(browser) { | 59 browser_(browser) { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { | 321 bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { |
327 if (command_id == IDC_SHOW_BOOKMARK_BAR) { | 322 if (command_id == IDC_SHOW_BOOKMARK_BAR) { |
328 return !browser_->profile()->GetPrefs()->IsManagedPreference( | 323 return !browser_->profile()->GetPrefs()->IsManagedPreference( |
329 prefs::kEnableBookmarkBar); | 324 prefs::kEnableBookmarkBar); |
330 } | 325 } |
331 return browser_->command_updater()->IsCommandEnabled(command_id); | 326 return browser_->command_updater()->IsCommandEnabled(command_id); |
332 } | 327 } |
333 | 328 |
334 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { | 329 bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { |
335 if (command_id == IDC_UPGRADE_DIALOG) { | 330 if (command_id == IDC_UPGRADE_DIALOG) { |
336 #if defined(OS_CHROMEOS) | |
337 return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status | |
338 == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); | |
339 #else | |
340 return UpgradeDetector::GetInstance()->notify_upgrade(); | 331 return UpgradeDetector::GetInstance()->notify_upgrade(); |
341 #endif | |
342 } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) { | 332 } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) { |
343 #if defined(OS_WIN) | 333 #if defined(OS_WIN) |
344 EnumerateModulesModel* loaded_modules = | 334 EnumerateModulesModel* loaded_modules = |
345 EnumerateModulesModel::GetInstance(); | 335 EnumerateModulesModel::GetInstance(); |
346 if (loaded_modules->confirmed_bad_modules_detected() <= 0) | 336 if (loaded_modules->confirmed_bad_modules_detected() <= 0) |
347 return false; | 337 return false; |
348 loaded_modules->AcknowledgeConflictNotification(); | 338 loaded_modules->AcknowledgeConflictNotification(); |
349 return true; | 339 return true; |
350 #else | 340 #else |
351 return false; | 341 return false; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 &enable_increment, &enable_decrement); | 548 &enable_increment, &enable_decrement); |
559 } | 549 } |
560 zoom_label_ = l10n_util::GetStringFUTF16( | 550 zoom_label_ = l10n_util::GetStringFUTF16( |
561 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 551 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
562 } | 552 } |
563 | 553 |
564 string16 WrenchMenuModel::GetSyncMenuLabel() const { | 554 string16 WrenchMenuModel::GetSyncMenuLabel() const { |
565 return sync_ui_util::GetSyncMenuLabel( | 555 return sync_ui_util::GetSyncMenuLabel( |
566 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); | 556 browser_->profile()->GetOriginalProfile()->GetProfileSyncService()); |
567 } | 557 } |
OLD | NEW |