| 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 36 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 37 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 37 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 38 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 38 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 39 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 39 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 40 #include "chrome/browser/ui/views/location_bar/star_view.h" | 40 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 41 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 41 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 42 #include "chrome/common/chrome_notification_types.h" | 42 #include "chrome/common/chrome_notification_types.h" |
| 43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 45 #include "content/browser/renderer_host/render_widget_host_view.h" | 45 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 46 #include "content/common/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 47 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 48 #include "grit/theme_resources.h" | 48 #include "grit/theme_resources.h" |
| 49 #include "grit/theme_resources_standard.h" | 49 #include "grit/theme_resources_standard.h" |
| 50 #include "ui/base/accessibility/accessible_view_state.h" | 50 #include "ui/base/accessibility/accessible_view_state.h" |
| 51 #include "ui/base/dragdrop/drag_drop_types.h" | 51 #include "ui/base/dragdrop/drag_drop_types.h" |
| 52 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
| 53 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
| 54 #include "ui/base/theme_provider.h" | 54 #include "ui/base/theme_provider.h" |
| 55 #include "ui/gfx/canvas_skia.h" | 55 #include "ui/gfx/canvas_skia.h" |
| 56 #include "ui/gfx/color_utils.h" | 56 #include "ui/gfx/color_utils.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 RefreshContentSettingViews(); | 328 RefreshContentSettingViews(); |
| 329 | 329 |
| 330 Layout(); | 330 Layout(); |
| 331 SchedulePaint(); | 331 SchedulePaint(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void LocationBarView::UpdatePageActions() { | 334 void LocationBarView::UpdatePageActions() { |
| 335 size_t count_before = page_action_views_.size(); | 335 size_t count_before = page_action_views_.size(); |
| 336 RefreshPageActionViews(); | 336 RefreshPageActionViews(); |
| 337 if (page_action_views_.size() != count_before) { | 337 if (page_action_views_.size() != count_before) { |
| 338 NotificationService::current()->Notify( | 338 content::NotificationService::current()->Notify( |
| 339 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, | 339 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, |
| 340 content::Source<LocationBar>(this), | 340 content::Source<LocationBar>(this), |
| 341 NotificationService::NoDetails()); | 341 content::NotificationService::NoDetails()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 Layout(); | 344 Layout(); |
| 345 SchedulePaint(); | 345 SchedulePaint(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void LocationBarView::InvalidatePageActions() { | 348 void LocationBarView::InvalidatePageActions() { |
| 349 size_t count_before = page_action_views_.size(); | 349 size_t count_before = page_action_views_.size(); |
| 350 DeletePageActionViews(); | 350 DeletePageActionViews(); |
| 351 if (page_action_views_.size() != count_before) { | 351 if (page_action_views_.size() != count_before) { |
| 352 NotificationService::current()->Notify( | 352 content::NotificationService::current()->Notify( |
| 353 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, | 353 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, |
| 354 content::Source<LocationBar>(this), | 354 content::Source<LocationBar>(this), |
| 355 NotificationService::NoDetails()); | 355 content::NotificationService::NoDetails()); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 void LocationBarView::OnFocus() { | 359 void LocationBarView::OnFocus() { |
| 360 // Focus the view widget first which implements accessibility for Chrome OS. | 360 // Focus the view widget first which implements accessibility for Chrome OS. |
| 361 GetWidget()->NotifyAccessibilityEvent( | 361 GetWidget()->NotifyAccessibilityEvent( |
| 362 this, ui::AccessibilityTypes::EVENT_FOCUS, false); | 362 this, ui::AccessibilityTypes::EVENT_FOCUS, false); |
| 363 | 363 |
| 364 // Then focus the native location view which implements accessibility for | 364 // Then focus the native location view which implements accessibility for |
| 365 // Windows. | 365 // Windows. |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 | 988 |
| 989 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 989 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
| 990 i != page_action_views_.end(); ++i) { | 990 i != page_action_views_.end(); ++i) { |
| 991 (*i)->UpdateVisibility(model_->input_in_progress() ? NULL : contents, | 991 (*i)->UpdateVisibility(model_->input_in_progress() ? NULL : contents, |
| 992 url); | 992 url); |
| 993 | 993 |
| 994 // Check if the visibility of the action changed and notify if it did. | 994 // Check if the visibility of the action changed and notify if it did. |
| 995 ExtensionAction* action = (*i)->image_view()->page_action(); | 995 ExtensionAction* action = (*i)->image_view()->page_action(); |
| 996 if (old_visibility.find(action) == old_visibility.end() || | 996 if (old_visibility.find(action) == old_visibility.end() || |
| 997 old_visibility[action] != (*i)->IsVisible()) { | 997 old_visibility[action] != (*i)->IsVisible()) { |
| 998 NotificationService::current()->Notify( | 998 content::NotificationService::current()->Notify( |
| 999 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 999 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 1000 content::Source<ExtensionAction>(action), | 1000 content::Source<ExtensionAction>(action), |
| 1001 content::Details<TabContents>(contents)); | 1001 content::Details<TabContents>(contents)); |
| 1002 } | 1002 } |
| 1003 } | 1003 } |
| 1004 } | 1004 } |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 #if defined(OS_WIN) && !defined(USE_AURA) | 1007 #if defined(OS_WIN) && !defined(USE_AURA) |
| 1008 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { | 1008 void LocationBarView::OnMouseEvent(const views::MouseEvent& event, UINT msg) { |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 !suggested_text_view_->GetText().empty(); | 1272 !suggested_text_view_->GetText().empty(); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 #if !defined(USE_AURA) | 1275 #if !defined(USE_AURA) |
| 1276 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1276 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
| 1277 CHECK(!views::Widget::IsPureViews()); | 1277 CHECK(!views::Widget::IsPureViews()); |
| 1278 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1278 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
| 1279 } | 1279 } |
| 1280 #endif | 1280 #endif |
| 1281 #endif | 1281 #endif |
| OLD | NEW |