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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 53153009: When the new profile management flag is enabled, make sure to use the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't simulate mouse events Created 7 years, 1 month 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "chrome/app/chrome_command_ids.h" 16 #include "chrome/app/chrome_command_ids.h"
17 #include "chrome/app/chrome_dll_resource.h" 17 #include "chrome/app/chrome_dll_resource.h"
18 #include "chrome/browser/app_mode/app_mode_utils.h" 18 #include "chrome/browser/app_mode/app_mode_utils.h"
19 #include "chrome/browser/bookmarks/bookmark_stats.h" 19 #include "chrome/browser/bookmarks/bookmark_stats.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
22 #include "chrome/browser/extensions/tab_helper.h" 22 #include "chrome/browser/extensions/tab_helper.h"
23 #include "chrome/browser/infobars/infobar_service.h" 23 #include "chrome/browser/infobars/infobar_service.h"
24 #include "chrome/browser/native_window_notification_source.h" 24 #include "chrome/browser/native_window_notification_source.h"
25 #include "chrome/browser/password_manager/password_manager.h" 25 #include "chrome/browser/password_manager/password_manager.h"
26 #include "chrome/browser/profiles/avatar_menu.h" 26 #include "chrome/browser/profiles/avatar_menu.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/profiles/profile_info_cache.h" 28 #include "chrome/browser/profiles/profile_info_cache.h"
29 #include "chrome/browser/profiles/profile_manager.h" 29 #include "chrome/browser/profiles/profile_manager.h"
30 #include "chrome/browser/profiles/profiles_state.h"
30 #include "chrome/browser/search/search.h" 31 #include "chrome/browser/search/search.h"
31 #include "chrome/browser/sessions/tab_restore_service.h" 32 #include "chrome/browser/sessions/tab_restore_service.h"
32 #include "chrome/browser/sessions/tab_restore_service_factory.h" 33 #include "chrome/browser/sessions/tab_restore_service_factory.h"
33 #include "chrome/browser/speech/tts_controller.h" 34 #include "chrome/browser/speech/tts_controller.h"
34 #include "chrome/browser/themes/theme_properties.h" 35 #include "chrome/browser/themes/theme_properties.h"
35 #include "chrome/browser/themes/theme_service_factory.h" 36 #include "chrome/browser/themes/theme_service_factory.h"
36 #include "chrome/browser/translate/translate_tab_helper.h" 37 #include "chrome/browser/translate/translate_tab_helper.h"
37 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 39 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
39 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" 40 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
(...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 const gfx::Rect& rect) { 2567 const gfx::Rect& rect) {
2567 gfx::Point origin(rect.origin()); 2568 gfx::Point origin(rect.origin());
2568 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); 2569 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin);
2569 gfx::Rect bounds(origin, rect.size()); 2570 gfx::Rect bounds(origin, rect.size());
2570 2571
2571 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT, 2572 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT,
2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); 2573 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get());
2573 } 2574 }
2574 2575
2575 void BrowserView::ShowAvatarBubbleFromAvatarButton() { 2576 void BrowserView::ShowAvatarBubbleFromAvatarButton() {
2576 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); 2577 if (profiles::IsNewProfileManagementEnabled()) {
2577 if (button) 2578 BrowserNonClientFrameView* frame_view =
sky 2013/11/05 04:08:25 Here you can do: frame_->GetFrameView()... And if
2578 button->ShowAvatarBubble(); 2579 static_cast<BrowserNonClientFrameView*>(
2580 views::Widget::GetWidgetForNativeView(
2581 browser_->window()->GetNativeWindow())->
2582 non_client_view()->frame_view());
2583 frame_view->ShowProfileChooserViewBubble();
2584 } else {
2585 AvatarMenuButton* button = frame_->GetAvatarMenuButton();
2586 if (button)
2587 button->ShowAvatarBubble();
2588 }
2579 } 2589 }
2580 2590
2581 void BrowserView::ShowPasswordGenerationBubble( 2591 void BrowserView::ShowPasswordGenerationBubble(
2582 const gfx::Rect& rect, 2592 const gfx::Rect& rect,
2583 const autofill::PasswordForm& form, 2593 const autofill::PasswordForm& form,
2584 autofill::PasswordGenerator* password_generator) { 2594 autofill::PasswordGenerator* password_generator) {
2585 // Create a rect in the content bounds that the bubble will point to. 2595 // Create a rect in the content bounds that the bubble will point to.
2586 gfx::Point origin(rect.origin()); 2596 gfx::Point origin(rect.origin());
2587 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); 2597 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin);
2588 gfx::Rect bounds(origin, rect.size()); 2598 gfx::Rect bounds(origin, rect.size());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 // The +1 in the next line creates a 1-px gap between icon and arrow tip. 2717 // The +1 in the next line creates a 1-px gap between icon and arrow tip.
2708 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - 2718 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() -
2709 LocationBarView::kIconInternalPadding + 1); 2719 LocationBarView::kIconInternalPadding + 1);
2710 ConvertPointToTarget(location_icon_view, this, &icon_bottom); 2720 ConvertPointToTarget(location_icon_view, this, &icon_bottom);
2711 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2721 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2712 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2722 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2713 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2723 top_arrow_height = infobar_top.y() - icon_bottom.y();
2714 } 2724 }
2715 return top_arrow_height; 2725 return top_arrow_height;
2716 } 2726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698