| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/bookmarks/bookmark_context_menu.h" | 5 #include "chrome/browser/bookmarks/bookmark_context_menu.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_utils.h" | 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| 11 #include "chrome/browser/metrics/user_metrics.h" | 11 #include "chrome/browser/metrics/user_metrics.h" |
| 12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 13 #include "chrome/browser/tab_contents/page_navigator.h" | 13 #include "chrome/browser/tab_contents/page_navigator.h" |
| 14 #include "chrome/common/l10n_util.h" | 14 #include "chrome/common/l10n_util.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/pref_service.h" | 16 #include "chrome/common/pref_service.h" |
| 17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 18 | 18 |
| 19 // TODO(port): Port these files. | 19 // TODO(port): Port these files. |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 22 #include "chrome/browser/views/bookmark_bar_view.h" | |
| 23 #include "chrome/browser/views/bookmark_editor_view.h" | 22 #include "chrome/browser/views/bookmark_editor_view.h" |
| 24 #include "chrome/browser/views/bookmark_manager_view.h" | 23 #include "chrome/browser/views/bookmark_manager_view.h" |
| 25 #include "chrome/browser/views/input_window.h" | 24 #include "chrome/browser/views/input_window.h" |
| 26 #include "chrome/views/window/window.h" | 25 #include "chrome/views/window/window.h" |
| 27 #endif | 26 #endif |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 // Returns true if the specified node is of type URL, or has a descendant | 30 // Returns true if the specified node is of type URL, or has a descendant |
| 32 // of type URL. | 31 // of type URL. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 case IDS_BOOMARK_BAR_NEW_FOLDER: { | 420 case IDS_BOOMARK_BAR_NEW_FOLDER: { |
| 422 UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_NewFolder", | 421 UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_NewFolder", |
| 423 profile_); | 422 profile_); |
| 424 | 423 |
| 425 EditFolderController::Show(profile_, wnd_, GetParentForNewNodes(), | 424 EditFolderController::Show(profile_, wnd_, GetParentForNewNodes(), |
| 426 true, (configuration_ != BOOKMARK_BAR)); | 425 true, (configuration_ != BOOKMARK_BAR)); |
| 427 break; | 426 break; |
| 428 } | 427 } |
| 429 | 428 |
| 430 case IDS_BOOMARK_BAR_ALWAYS_SHOW: | 429 case IDS_BOOMARK_BAR_ALWAYS_SHOW: |
| 431 BookmarkBarView::ToggleWhenVisible(profile_); | 430 bookmark_utils::ToggleWhenVisible(profile_); |
| 432 break; | 431 break; |
| 433 | 432 |
| 434 case IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER: | 433 case IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER: |
| 435 UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_ShowInFolder", | 434 UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_ShowInFolder", |
| 436 profile_); | 435 profile_); |
| 437 | 436 |
| 438 if (selection_.size() != 1) { | 437 if (selection_.size() != 1) { |
| 439 NOTREACHED(); | 438 NOTREACHED(); |
| 440 return; | 439 return; |
| 441 } | 440 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 if (NodeHasURLs(selection_[i])) | 579 if (NodeHasURLs(selection_[i])) |
| 581 return true; | 580 return true; |
| 582 } | 581 } |
| 583 return false; | 582 return false; |
| 584 } | 583 } |
| 585 | 584 |
| 586 BookmarkNode* BookmarkContextMenu::GetParentForNewNodes() const { | 585 BookmarkNode* BookmarkContextMenu::GetParentForNewNodes() const { |
| 587 return (selection_.size() == 1 && selection_[0]->is_folder()) ? | 586 return (selection_.size() == 1 && selection_[0]->is_folder()) ? |
| 588 selection_[0] : parent_; | 587 selection_[0] : parent_; |
| 589 } | 588 } |
| OLD | NEW |