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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_image_model.cc

Issue 1955083003: [Material Design] Update Website Setting Icons in Omnibox on OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for shrike's review Created 4 years, 7 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/content_settings/content_setting_image_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/gfx/color_palette.h" 21 #include "ui/gfx/color_palette.h"
22 #include "ui/gfx/color_utils.h" 22 #include "ui/gfx/color_utils.h"
23 #include "ui/gfx/paint_vector_icon.h" 23 #include "ui/gfx/paint_vector_icon.h"
24 #include "ui/gfx/vector_icons_public.h" 24 #include "ui/gfx/vector_icons_public.h"
25 25
26 using content::WebContents; 26 using content::WebContents;
27 27
28 namespace { 28 namespace {
29 29
30 bool UseVectorGraphics() { 30 bool UseVectorGraphics() {
31 #if defined(OS_MACOSX)
32 return false;
33 #else
34 return ui::MaterialDesignController::IsModeMaterial(); 31 return ui::MaterialDesignController::IsModeMaterial();
35 #endif
36 } 32 }
37 33
38 } // namespace 34 } // namespace
39 35
40 // The image models hierarchy: 36 // The image models hierarchy:
41 // 37 //
42 // ContentSettingImageModel - base class 38 // ContentSettingImageModel - base class
43 // ContentSettingSimpleImageModel - single content setting 39 // ContentSettingSimpleImageModel - single content setting
44 // ContentSettingBlockedImageModel - generic blocked setting 40 // ContentSettingBlockedImageModel - generic blocked setting
45 // ContentSettingGeolocationImageModel - geolocation 41 // ContentSettingGeolocationImageModel - geolocation
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 result.push_back(new ContentSettingMIDISysExImageModel()); 566 result.push_back(new ContentSettingMIDISysExImageModel());
571 567
572 return result; 568 return result;
573 } 569 }
574 570
575 void ContentSettingImageModel::SetIconByResourceId(int id) { 571 void ContentSettingImageModel::SetIconByResourceId(int id) {
576 raster_icon_id_ = id; 572 raster_icon_id_ = id;
577 raster_icon_ = 573 raster_icon_ =
578 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); 574 ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id);
579 } 575 }
576
577 bool ContentSettingImageModel::UpdateFromWebContentsAndCheckIfIconChanged(
578 content::WebContents* web_contents) {
579 if (UseVectorGraphics()) {
580 gfx::VectorIconId old_vector_icon = vector_icon_id_;
581 gfx::VectorIconId old_badge_icon = vector_icon_badge_id_;
582 UpdateFromWebContents(web_contents);
583 return old_vector_icon != vector_icon_id_ &&
584 old_badge_icon != vector_icon_badge_id_;
585 } else {
586 int old_icon = raster_icon_id_;
587 UpdateFromWebContents(web_contents);
588 return old_icon != raster_icon_id_;
589 }
590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698